Re: extending a shopping cart
ok, answering my own question here, kind of.
attempt 1.
# get the objects for this content type, then choose the object by id
ct = ContentType.objects.get_for_model(app_label=app,
name=content_type)
p = ct.get_object_for_this_type(pk=object_id)
the above code works to get the object and allows me to add the object
to the cart.
im not sure why name=content_type works when model=content_type isnt
working.
its got to be to do with the line that populates content_type, which
is
form.fields['content_type'].widget.attrs['value'] =
ContentType.objects.get_for_model(SuspFitment)
so this is returning the name for the model, how would i go about
returning the model attribute?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home