Changes between Version 8 and Version 9 of ModelSyntaxChangeInstructions
- Timestamp:
- Aug 25, 2005, 6:09:07 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ModelSyntaxChangeInstructions
v8 v9 10 10 * Meta information (anything that's NOT a field, such as {{{ordering}}}, {{{admin}}}, {{{unique_together}}}, etc.) now goes in an inner class, called {{{META}}} (note the all caps). This class doesn't have a parent class. 11 11 * To manually specify a field's database column name, use {{{db_column}}} as an argument to {{{*Field()}}}. 12 * When instantiating an object, you can now pass in many-to-one related object instances. Example: {{{p = polls.get_object(pk=1); choice = choices.Choice(poll=p, choice="Hello", votes=0)}}}. Note that {{{choices.choice(poll_id=p.id, ...)}}} still works. 12 13 * Each field is required to have an explicit name -- even {{{ForeignKey}}}s, {{{ManyToManyField}}}s and {{{OneToOneFields}}}. This solves the problem of "How do I refer to my field from within admin.fields?" 13 14 * {{{rel_name}}} is no longer used for {{{ForeignKey}}}s. If your model has more than one {{{ForeignKey}}} to the same foreign model, differentiate the fields using the field name, not {{{rel_name}}}. See [http://www.djangoproject.com/documentation/models/m2o_recursive2/ Relating a model to another model more than once] for an example.