Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 61e6ffb

Browse files
committed
Agregada app polls al admin, y override str method de los modelos Question y Choice, added al gitignore las migraciones de app polls
1 parent dc00d5f commit 61e6ffb

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ __pycache__/
99
#i dont know what is this folder
1010
.idea/
1111

12+
#migrations
13+
apps/polls/migrations
14+
1215
# Distribution / packaging
1316
.Python
1417
build/

‎apps/polls/models.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
from django.db import models
22

3+
34
# Create your models here.
45

56
class Question(models.Model):
67
question_text = models.CharField(max_length=200)
78
pub_date = models.DateTimeField('date published')
89

10+
def __str__(self):
11+
return self.question_text
12+
13+
14+
915
class Choice(models.Model):
10-
question =models.ForeignKey(Question, on_delete=models.CASCADE)
16+
question =models.ForeignKey(Question, on_delete=models.CASCADE)
1117
choice_text = models.CharField(max_length=200)
12-
votes=models.IntegerField(default=0)
18+
votes = models.IntegerField(default=0)
19+
20+
def __str__(self):
21+
return self.choice_text

‎mysite/settings.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# Application definition
3232

3333
INSTALLED_APPS = [
34+
'apps.polls.apps.PollsConfig',
3435
'django.contrib.admin',
3536
'django.contrib.auth',
3637
'django.contrib.contenttypes',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /