Commit 94b06409 authored by David Haynes's avatar David Haynes 🙆
Browse files

Fix minor issues (doc, #'s, and more template errors)

- a very productive day
parent ff607638
...@@ -16,6 +16,7 @@ class URLForm(forms.ModelForm): ...@@ -16,6 +16,7 @@ class URLForm(forms.ModelForm):
}) })
) )
# Check to make sure the short url has not been used
def unique_short(value): def unique_short(value):
try: try:
URL.objects.get(short__iexact=value) URL.objects.get(short__iexact=value)
......
...@@ -43,7 +43,7 @@ class URL(models.Model): ...@@ -43,7 +43,7 @@ class URL(models.Model):
tries = 1 tries = 1
while tries < 100: while tries < 100:
try: try:
# urls = URL.objects.get(short__iexact=short) urls = URL.objects.get(short__iexact=short)
tries += 1 tries += 1
hashids_counter += 1 hashids_counter += 1
except URL.DoesNotExist: except URL.DoesNotExist:
......
...@@ -117,7 +117,7 @@ def index(request): ...@@ -117,7 +117,7 @@ def index(request):
random_short = URL.generate_valid_short() random_short = URL.generate_valid_short()
if random_short is None: if random_short is None:
return HttpResponseServerError( return HttpResponseServerError(
render(request, 'core/500.html', {}) render(request, '500.html', {})
) )
else: else:
url.short = random_short url.short = random_short
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment