I am creating a CRUD application. The create, read and delete function are
working but edit record is showing the instance in the form* but it is not
saving changes.*
*Here is my code.*
*===*
*views.py*
def edit(request, id):
student = Student.objects.get(id=id)
form = StudentForm
Thanks
Actually earlier i was passing instance of Phone
phoneform = PhoneForm(request.POST,instance=Phone.objects.get
(user=request.user))
but at very first time there was no record in Phone table
that is what i was getting the sql query is not matching
so i tried with
try:
userob =
You are created a PhoneForm but passing it an instance of User. You
need to pass the form an instance of the model it works on.
- Tom
On Jan 30, 3:45 pm, Praveen wrote:
> Hi
>
> here is my views
> def phone_register(request, success_url=None,form_class = PhoneForm,
> template
Hi
here is my views
def phone_register(request, success_url=None,form_class = PhoneForm,
template_name="phone/phonereg_form.html", extra_context=None):
userobj = User.objects.get(pk=request.user.id)
if request.method == 'POST':
phoneform = form_class(request.POST, i
4 matches
Mail list logo