Hi,

New to Django but trying to stick with it.

I have created a model form, which creates ok.

I am trying to edit records. I have the following, but keep getting the 
QuerySet object has no attribute '_meta' in the browser.

my views.py

def editbusiness(request):
data = models.Businessownercreate.objects.all() 
if request.method == "POST": 
form = forms.Businessownercreate(request.POST, instance=data)
if form.is_valid():
form.save()
return redirect("accounts:editremovebusiness")
else: 
form = forms.Businessownercreate(instance=data)
return render(request, 'editbusiness.html', context={ 'form':form })

my forms.py 

class Businessownercreate(forms.ModelForm):
class Meta:
model = Businessownercreate
fields = [ "Creator", "Micro_Small_Medium", "Business_Name", 
"Owner_Firstname", 
"Owner_Surname", "Companies_House_Number", "Address_Line_1", 
"Address_Line_2",
"Town", "City", "County", "Postcode", "Email", "Phone", "Mobile" ]

I'm have defined the meta, so i can't see why the query cant return the 
objects from the model to the form in this instance.

Please can anyone advise or help?

Best,

K



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e4d57f1-e41b-4692-8814-1c1888e563dc%40googlegroups.com.

Reply via email to