google app engine - problem with filtering in a referenceproperty dropdown - Django -
I have the following problem I have a contact class that different users can tag themselves with their own topics: < / P>
Category contact (db.Model): contact_date = db.DateProperty (auto_now_add = true) comment = db.TextProperty () theme = db.ReferenceProperty (theme) Category topic (db.Model): Topic = db.StringProperty (required = true) Description = db.TextProperty () Owner = db.ReferenceProperty (user, collection_name = 'topic_set') def __unicode __ (self): return '% s'% (self.topic) < / Code>
for the form of i
Category ContactForm (forms.ModelForm): def __init __ (self, user_filter, * args, ** kwargs): self.base_fields ['subject ']. Queryset = Topic.all (). Filter ('owner =', user_filter) Super (ContactForm, self) .__ init __ (* args, ** kwargs)
I call ContactForm again as follows:
form = ContactForm (user_filter) = Request.user.key ())
All this works as XP ected. However, when I receive my form:
An exception was caught while rendering: unsupported type of property: & lt; Class 'django.http.QueryDict' & gt;
Am I doing something wrong? Is there any problem with implementing an appendage for Dzengo? Peter
There may be one subject and one subject in one contact. As you explained:
I have a contact class that different users can tag themselves with their own subjects
I reference property
for the subject class:
class subject (db.Model): contact = db.ReferenceProperty (contact)
now in a contact There can be many topics.
Your exception comes from specifying an asset with a request query dictionary. It probably comes as a code by declaring the user_filter
, but it is used as a keyword logic. It should be:
form = ContactForm (request.user.key ())
But as explained above, first you modify your model should do. / P>
Comments
Post a Comment