File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
from django .contrib import admin
2
+ from polls .models import Question , Choice
2
3
3
- # Register your models here.
4
+ admin .site .register (Question )
5
+ admin .site .register (Choice )
Original file line number Diff line number Diff line change 1
1
from django .db import models
2
2
3
- # Create your models here.
3
+
4
+ class Question (models .Model ):
5
+ question_text = models .CharField (max_length = 200 )
6
+ pub_date = models .DateTimeField ('date published' )
7
+
8
+ def __unicode__ (self ): # __str__ on Python 3
9
+ return self .question_text
10
+
11
+
12
+ class Choice (models .Model ):
13
+ question = models .ForeignKey (Question )
14
+ choice_text = models .CharField (max_length = 200 )
15
+ votes = models .IntegerField (default = 0 )
16
+
17
+ def __unicode__ (self ):
18
+ return self .choice_text
You can’t perform that action at this time.
0 commit comments