their is no error message
-- i am doing something wrong in my forms
which is being solved
thank you
which is being solved
thank you
regards
On Friday, January 26, 2018 at 3:09:43 AM UTC+5:30, Andy wrote:
On Friday, January 26, 2018 at 3:09:43 AM UTC+5:30, Andy wrote:
what is the actual error message?
Am Dienstag, 23. Januar 2018 21:10:00 UTC+1 schrieb harsh sharma:i am trying to save the basic information about a personi have created a model form for it but i am unable to save the object (unable to update the database)here is my views file@login_required
def dashboard(request):
if request.method=="post":
form = linkform(request.POST)
if form.is_valid():
try:
notes = form.cleaned_data['note']
link = form.cleaned_data['link']
number = form.cleaned_data['number']
perso = person.object.create_person(notes,link,number)
perso.save()
return HttpResponse('succeess')
except:
return HttpResponse('can not create object')
else:
return HttpResponse('bad form')
else:
form = linkform(request.POST)
return render(request, 'dashboard.html', {'form':form})here is my model file :class personmanager(models.Manager):
def create_person(self,note,link,number):
pers = self.create(note=note,link=link,number=number)
return pers
class person(models.Model):
notes = models.TextField()
link = models.URLField()
number = models.IntegerField()
object = personmanager()
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/391cbb98-31a0-4f94-ab20-3692e204fd1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment