Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated example database. Added base fixtures. Added a few new fields…
… for example reasons.
- Loading branch information
Showing
11 changed files
with
63 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.contrib import admin | ||
from sillywalks.models import SillyWalk | ||
|
||
class SillyWalkAdmin(admin.ModelAdmin): | ||
prepopulated_fields = {"slug": ("title",)} | ||
|
||
admin.site.register(SillyWalk, SillyWalkAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[ | ||
{ | ||
"pk": 1, | ||
"model": "sillywalks.sillywalk", | ||
"fields": { | ||
"description": "Nothing is better than the original!", | ||
"slug": "ministry-of-silly-walks", | ||
"video_url": "http://www.youtube.com/v/9ZlBUglE6Hc&hl=en&fs=1", | ||
"title": "Ministry of Silly Walks" | ||
} | ||
}, | ||
{ | ||
"pk": 2, | ||
"model": "sillywalks.sillywalk", | ||
"fields": { | ||
"description": "Silly walk thru Derry-Londonderry - a tribute to the legend, John Cleese. Music: \"Blaze Away\" Performed by the Britannia Band (L'derry).", | ||
"slug": "ministry-of-silly-walks-derry-style", | ||
"video_url": "http://www.youtube.com/v/m99n93dL5Mc&hl=en&fs=1", | ||
"title": "Ministry of Silly Walks - Derry Style!" | ||
} | ||
}, | ||
{ | ||
"pk": 1, | ||
"model": "complaints.complaint", | ||
"fields": { | ||
"pluggable_url": "KGRwMQpTJ3ByZWZpeCcKcDIKUydzaWxseXdhbGtzJwpwMwpzUydwYXJlbnRfa3dhcmdzJwpwNAooZHA1ClMnd2Fsa19zbHVnJwpwNgpWbWluaXN0cnktb2Ytc2lsbHktd2Fsa3MtZGVycnktc3R5bGUKcDcKc3NTJ3BhcmVudF9hcmdzJwpwOAoodHMu", | ||
"name": "Nowell Strite", | ||
"description": "Nice try buddy, but nothing is as good as the original." | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
class SillyWalkForm(forms.ModelForm): | ||
class Meta: | ||
model = SillyWalk | ||
exclude = ('slug',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
from django.db import models | ||
from django.contrib import admin | ||
from django.template.defaultfilters import slugify | ||
|
||
class SillyWalk(models.Model): | ||
name = models.SlugField(unique=True) | ||
title = models.CharField(max_length=100) | ||
slug = models.SlugField(unique=True) | ||
description = models.TextField() | ||
video_url = models.URLField() | ||
|
||
def __unicode__(self): | ||
return self.name | ||
return self.title | ||
|
||
admin.site.register(SillyWalk) | ||
def save(self, *args, **kwargs): | ||
if not self.slug: | ||
self.slug = slugify(self.title) | ||
super(SillyWalk, self).save(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters