diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-08-25 22:51:30 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-08-25 22:51:30 +0000 |
| commit | 25264c86048d442a4885dfebae94510e2fa0c1e4 (patch) | |
| tree | bb02799b624fb0d6f931d208509ffbb50d00e358 /docs/overview.txt | |
| parent | aec0a73d73324820c767758afd250fc21a2896ef (diff) | |
Fixed #122 -- BIG, BACKWARDS-INCOMPATIBLE CHANGE. Changed model syntax to use fieldname=FieldClass() syntax. See ModelSyntaxChangeInstructions for important information on how to change your models
git-svn-id: http://code.djangoproject.com/svn/django/trunk@549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/overview.txt')
| -rw-r--r-- | docs/overview.txt | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/docs/overview.txt b/docs/overview.txt index 6917ef8a1d..90e3db9302 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -21,20 +21,16 @@ offers many rich ways of representing your models -- so far, it's been solving two years' worth of database-schema problems. Here's a quick example:: class Reporter(meta.Model): - fields = ( - meta.CharField('full_name', maxlength=70), - ) + full_name = meta.CharField(maxlength=70) def __repr__(self): return self.full_name class Article(meta.Model): - fields = ( - meta.DateTimeField('pub_date'), - meta.CharField('headline', maxlength=200), - meta.TextField('article'), - meta.ForeignKey(Reporter), - ) + pub_date = meta.DateTimeField('pub_date') + headline = meta.CharField('headline', maxlength=200) + article = meta.TextField('article') + reporter = meta.ForeignKey(Reporter) def __repr__(self): return self.headline @@ -134,17 +130,16 @@ A dynamic admin interface: It's not just scaffolding -- it's the whole house Once your models are defined, Django can automatically create an administrative interface -- a Web site that lets authenticated users add, change and -delete objects. It's as easy as adding an extra admin attribute to your model -classes:: +delete objects. It's as easy as adding an extra ``admin`` attribute to your +model classes:: class Article(meta.Model): - fields = ( - meta.DateTimeField('pub_date'), - meta.CharField('headline', maxlength=200), - meta.TextField('article'), - meta.ForeignKey(Reporter), - ) - admin = meta.Admin() + pub_date = meta.DateTimeField('pub_date') + headline = meta.CharField('headline', maxlength=200) + article = meta.TextField('article') + reporter = meta.ForeignKey(Reporter) + class META: + admin = meta.Admin() The philosophy here is that your site is edited by a staff, or a client, or maybe just you -- and you don't want to have to deal with creating backend |
