Ok thanks is there a way to call all objects, as this is more user friendly
and efficient when potentially editing many object fields?
On Sun, 18 Aug 2019 at 18:05, Daniel Roseman wrote:
> You can't pass *all* the objects to the form. You have to get the specific
> one you want to edit and pass
You can't pass *all* the objects to the form. You have to get the specific one
you want to edit and pass that as the instance.
--
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,
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
The ArtworkForm AND the full view code would be helpful, yes
also, maybe you'll want to install django-extensions, werkzeug, and
run your devserver with runserver_plus, that'll give you full
debugging capabilities on your browser, and will be able to see what's
each object (that instace object,
tils/decorators.py"
>> in
>>
>> _wrapped_view
>> 91. response = view_func(request, *args, **kwargs)
>> File "/home/deathweasel/shiny-website/deathweasel/artwork/views.py" in
>> modify_artwork
>> 94. artForm = ArtworkForm(instan
s, **kwargs)
> File "/home/deathweasel/shiny-website/deathweasel/artwork/views.py" in
> modify_artwork
> 94. artForm = ArtworkForm(instance=my_art)
> File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in
> __init__
> 238. obj
usr/local/lib/python2.7/dist-packages/django/forms/models.py" in
__init__
238. object_data = model_to_dict(instance, opts.fields,
opts.exclude)
File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in
model_to_dict
111. opts = instance._meta
Except
,
> > > > **callback_kwargs)
> > > > File "C:\Django\demo\..\demo\home\views.py" in product
> > > > 10. form = ProductForm(instance=product)
> > > > File "C:\Python25\Lib\site-packages\django\forms\models.py" in
> > >
= ProductForm(instance=product)
> > > File "C:\Python25\Lib\site-packages\django\forms\models.py" in
> > > __init__
> > > 216. object_data = model_to_dict(instance, opts.fields,
> > > opts.exclude)
> > > File "C:\Python25\Lib\
on25\Lib\site-packages\django\forms\models.py" in
> > __init__
> > 216. object_data = model_to_dict(instance, opts.fields,
> > opts.exclude)
> > File "C:\Python25\Lib\site-packages\django\forms\models.py" in
> > model_to_dict
> >
django\forms\models.py" in
> __init__
> 216. object_data = model_to_dict(instance, opts.fields,
> opts.exclude)
> File "C:\Python25\Lib\site-packages\django\forms\models.py" in
> model_to_dict
> 119. opts = instance._meta
>
> Exception Typ
ite-packages\django\forms\models.py" in
__init__
216. object_data = model_to_dict(instance, opts.fields,
opts.exclude)
File "C:\Python25\Lib\site-packages\django\forms\models.py" in
model_to_dict
119. opts = instance._meta
Exception Type: AttributeError at /product
12 matches
Mail list logo