Ticket #913: pictures.py

File pictures.py, 808 bytes (added by eugene@…, 19 years ago)

one more example

Line 
1from django.core import meta
2
3class Picture(meta.Model):
4 name = meta.CharField(maxlength=50)
5 picture_width = meta.PositiveIntegerField(editable=False)
6 picture_height = meta.PositiveIntegerField(editable=False)
7 picture = meta.ImageField(width_field='picture_width', height_field='picture_height', upload_to='pictures/images')
8 description = meta.TextField(blank=True, null=True)
9
10 class META:
11 admin = meta.Admin(
12 fields = (
13 (None, {'fields': ('name', 'description',)}),
14 ),
15 list_display = ('name', 'description',),
16 list_filter = ('name',),
17 ordering = ('id',),
18 search_fields = ['name', 'description',],
19 )
20
21 def __repr__(self):
22 return self.name
Back to Top