python - Modelform not printing fields of one to many relationships -


Summary: I have several hierarchical connections between models

Country (1) - & gt; City (lot)

City (1) - & gt; Status (too)

I have a form that seems to print the field related to all these models, but when I print, I see only one city. The field and that also appear as a drop-down list instead of appearing in the form of a text box. I tried to search for this problem, but there was no solution.

code snippet:

  from google.appengine.ext import db google appengine.ext.db import djangoforms class UserReportedCountry (db.Model) user COUNTRY_NAME = selected by db.StringProperty #country (required = true option = [ 'Afghanistan', 'aring land island "]) class UserReportedCity (db. model): country = db.ReferenceProperty (UserReportedCountry, COLLECTION_NAME =' cities ') CITY_NAME = db.StringProperty (required = true) class UserReportedStatus (db.Model): city = db.ReferenceProperty (UserReportedCity, COLLECTION_NAME =' conditions') status = db.BooleanProperty (required = true) DATE_TIME = db.DateTimeProperty (Auto_now_add = true) class UserReportedDataForm (djangoforms.ModelForm): Class meta model = UserReportedStatus out = ('statusâ ????)   

thanks,

[edit # 1] < / P>

I accidentally came to this post () and followed the method that used the submiter to garding the printing forms on the page

] Model now forms in class

  class UserCountryForm (djangoforms.ModelForm): class meta model = UserReportedCountry class UserCityForm (djangoforms. ModelForm): class Meta Model = UserReportedCity, = ( 'country outside the square) UserStatusForm (djangoforms.ModelForm): class Meta Model = UserReportedStatus site_is_up property = out #hiding (' site_is_up ',' City ')   

B] method which print these forms:

  Diaf print_user_reporting_form (self): self.response_variable.out.write ( '& lt; div id = " Userdataform "& gt; '' & lt; form method =" POST "'' action =" / userReporting ">" & lt; table & gt; ') #method Pre-populated with users' country and city price To print a user form, call self.response_variable out.write (UserCountryFo rm ()) self.response_variable.out.write (UserCityForm ()) self.response_variable.out.write (UserStatusForm ()) self.response_variable.out.write ( '& lt; / TABLE & gt;' '& lt; Input type = "submit_" name = "report_" value "=" report "& gt; '' input type =" submit "name =" report_down "value =" report down "& gt; '' & Lt; / form & gt; '' & Lt; / Div & gt; ')   

Thanks,

Your form output correctly Happening.

You are one of the many relationships between cities and situations.

  country __ __ __ __ __ __ __ __ | __ __ __ __ __ __ __ / | | City city city _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | | | | | | | | | | | | | | Sssssssssssssss   

If you have a form that is linking between a situation and a city, you can do this often to make a city in relation to many situations.

The drop down is asking which city you want to associate with your situation.

You do not include the status area in detail and

note

as currently applied, auto_now or auto_now_add to True The Setting field will be editable = false and empty = True.

Comments