Changes between Version 10 and Version 11 of CookBookCategoryDataModel


Ignore:
Timestamp:
Sep 25, 2005, 12:40:37 PM (19 years ago)
Author:
srawlin@…
Comment:

Updated code to use new model syntax

Legend:

Unmodified
Added
Removed
Modified
  • CookBookCategoryDataModel

    v10 v11  
    99{{{
    1010class Category(meta.Model):
    11     verbose_name_plural = 'Categories'
    12     module_name = verbose_name_plural.lower()
    13     fields = (
    14         meta.CharField('category_name', maxlength=50),
    15         meta.ForeignKey('self', blank=True, null=True,
    16             rel_name='parent', related_name='child'),
    17         meta.ForeignKey(User)
    18     )
     11    category_name = meta.CharField(maxlength=50)
     12    parent = meta.ForeignKey('self', blank=True, null=True,
     13                             related_name='child')
    1914
    2015    def _recurse_for_parents(self, cat_obj):
     
    4843        return self.get_separator().join(p_list)
    4944
    50     admin = meta.Admin(
    51         list_display = ('category_name', '_parents_repr'),
    52         search_fields = ['category_name'],
    53     )
     45    class META:
     46        admin = meta.Admin(
     47            list_display = ('category_name', '_parents_repr'),
     48            search_fields = ['category_name'],
     49        )
     50        module_name = 'categories'
    5451}}}
    5552
     
    107104{{{
    108105class Document(meta.Model):
    109     fields = (
    110         meta.CharField('title', maxlength=200),
    111         meta.ForeignKey(Category, name='subject', blank=True, null=True),
    112         ...
     106    title = meta.CharField('title', maxlength=200),
     107    subject = meta.ForeignKey(Category, blank=True, null=True),
     108    ...
    113109}}}
    114110
Back to Top