Changes between Version 8 and Version 9 of ModelSyntaxChangeInstructions


Ignore:
Timestamp:
08/25/2005 06:09:07 PM (10 years ago)
Author:
adrian
Comment:

Added note about new init() params

Legend:

Unmodified
Added
Removed
Modified
  • ModelSyntaxChangeInstructions

    v8 v9  
    1010 * 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.
    1111 * 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.
    1213 * 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?"
    1314 * {{{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.
Back to Top