Open
Description
I try to put "www.xxx,com" twice ,but I got the same page "Success",
I think it would be better to change the post function in HomeView
'''
def post(self, request, *args, **kwargs):
pform = SubmitUrlForm(request.POST)
context = {
"title": "Kirr.co",
"form": pform
}
template = "shortener/home.html"
if pform.is_valid():
#print pform.cleaned_data
new_url = pform.cleaned_data.get("url")
new2_url = validate_url(new_url)
obj, created = KirrURL.objects.get_or_create(url=new2_url)
context = {
"object": obj,
"created": created,
}
if created:
template = "shortener/success.html"
else:
template = "shortener/already-exists.html"
return render(request, template ,context)
'''
Metadata
Metadata
Assignees
Labels
No labels