You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
'''
The text was updated successfully, but these errors were encountered:
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)
'''
The text was updated successfully, but these errors were encountered: