Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: swmcc/django-tutorial
base: b027827dc1
...
head fork: swmcc/django-tutorial
compare: e7017ababc
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
BIN  mysite/settings.pyc
Binary file not shown
View
17 polls/admin.py
@@ -1,4 +1,19 @@
from django.contrib import admin
+from polls.models import Choice
from polls.models import Question
-admin.site.register(Question)
+class ChoiceInline(admin.TabularInline):
+ model = Choice
+ extra = 3
+
+class QuestionAdmin(admin.ModelAdmin):
+ fieldsets = [
+ (None, {'fields': ['question_text']}),
+ ['Date information', {'fields': ['pub_date'], 'classes': ['collapse']}],
+ ]
+ inlines = [ChoiceInline]
+ list_display = ('question_text', 'pub_date', 'was_published_recently')
+ list_filter = ['pub_date']
+ search_fields = ['question_text']
+
+admin.site.register(Question, QuestionAdmin)
View
BIN  polls/admin.pyc
Binary file not shown
View
4 polls/models.py
@@ -11,7 +11,9 @@ def __unicode__(self):
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
-
+ was_published_recently.admin_order_field = 'pub_date'
+ was_published_recently.boolean = True
+ was_published_recently.short_description = 'Published recently?'
class Choice(models.Model):
question = models.ForeignKey(Question)
View
BIN  polls/models.pyc
Binary file not shown

No commit comments for this range

Something went wrong with that request. Please try again.