Changes between Version 39 and Version 40 of NewformsAdminBranch
- Timestamp:
- Dec 3, 2007, 8:40:31 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewformsAdminBranch
v39 v40 87 87 # a sample models.py file 88 88 from django.db import models 89 from django.contrib import admin 89 90 90 91 class Author(models.Model): 91 first_name = models.CharField(max length=30)92 last_name = models.CharField(max length=30)93 94 def __ str__(self):95 return '%s %s' % (self.first_name, self.last_name)92 first_name = models.CharField(max_length=30) 93 last_name = models.CharField(max_length=30) 94 95 def __unicode__(self): 96 return u'%s %s' % (self.first_name, self.last_name) 96 97 97 98 class Book(models.Model): 98 title = models.CharField(max length=100)99 title = models.CharField(max_length=100) 99 100 author = models.ForeignKey(Author) 100 101 from django.contrib import admin102 101 103 102 class BookOptions(admin.ModelAdmin): … … 168 167 # OLD: 169 168 class MyModel(models.Model): 170 first_name = models.CharField(max length=30)171 last_name = models.CharField(max length=30)172 slug = models.CharField(max length=60, prepopulate_from=('first_name', 'last_name'))169 first_name = models.CharField(max_length=30) 170 last_name = models.CharField(max_length=30) 171 slug = models.CharField(max_length=60, prepopulate_from=('first_name', 'last_name')) 173 172 174 173 class Admin: … … 177 176 # NEW: 178 177 class MyModel(models.Model): 179 first_name = models.CharField(max length=30)180 last_name = models.CharField(max length=30)181 slug = models.CharField(max length=60)178 first_name = models.CharField(max_length=30) 179 last_name = models.CharField(max_length=30) 180 slug = models.CharField(max_length=60) 182 181 183 182 from django.contrib import admin … … 273 272 raw_id_fields = ('field1',) 274 273 }}} 275