Ticket #9076: models.py

File models.py, 553 bytes (added by coady, 16 years ago)
Line 
1from django.db import models
2from django.contrib import admin
3
4class Poll(models.Model):
5 question = models.CharField(max_length=200)
6 pub_date = models.DateTimeField('date published')
7
8class Choice(models.Model):
9 poll = models.ForeignKey(Poll)
10 # choice = models.CharField(max_length=200)
11 votes = models.IntegerField()
12
13class ChoiceInline(admin.TabularInline):
14 model = Choice
15 extra = 3
16
17class PollAdmin(admin.ModelAdmin):
18 fields = ['pub_date', 'question']
19 inlines = [ChoiceInline]
20
21admin.site.register(Poll, PollAdmin)
Back to Top