Skip to content

Commit

Permalink
Added the base URL's for the news entrys, changed the model so that t…
Browse files Browse the repository at this point in the history
…he title of each news entry has to be unique, and changed the news fixture to not load the django_generic_flatblocks data since it isn't needed
  • Loading branch information
qgriffith committed Feb 17, 2012
1 parent 6957c05 commit a1d76ff
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
15 changes: 3 additions & 12 deletions news/fixtures/initial_data.json
Expand Up @@ -7,17 +7,8 @@
"image": "",
"pub_date": "2010-10-10 13:32:47",
"slug": "test-news-entry",
"title": "OpenEats 2"
}
},
{
"pk": 1,
"model": "django_generic_flatblocks.genericflatblock",
"fields": {
"slug": "test-news-entry",
"content_type": 30,
"object_id": 1
"title": "OpenEats 2",
"frontpage":1
}
}

]
]
33 changes: 33 additions & 0 deletions news/migrations/0004_auto__add_unique_entry_title.py
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

def forwards(self, orm):

# Adding unique constraint on 'Entry', fields ['title']
db.create_unique('news_entry', ['title'])

def backwards(self, orm):

# Removing unique constraint on 'Entry', fields ['title']
db.delete_unique('news_entry', ['title'])

models = {
'news.entry': {
'Meta': {'object_name': 'Entry'},
'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'frontpage': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'pub_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
}
}

complete_apps = ['news']
2 changes: 1 addition & 1 deletion news/models.py
Expand Up @@ -3,7 +3,7 @@
from django.utils.translation import ugettext_lazy as _

class Entry(models.Model):
title = models.CharField(_('title') ,max_length=255, blank=True)
title = models.CharField(_('title') ,max_length=255, unique=True)
slug = AutoSlugField(_('slug'), populate_from='title', unique=True)
content = models.TextField(_('content'), blank=True)
frontpage = models.BooleanField(_('frontpage'), default=False, help_text="determines if the story appears on the front page")
Expand Down
7 changes: 7 additions & 0 deletions news/urls.py
@@ -0,0 +1,7 @@
from django.conf.urls.defaults import *

urlpatterns = patterns('',
# url(r'^list/$', 'news.views.list', name="news_list"),
#url(r'^entry/(?P<title>[\w-]+)/$', 'news.views.entry', name="news_entry"),

)
1 change: 1 addition & 0 deletions urls.py
Expand Up @@ -31,6 +31,7 @@
(r'^tags/', include('tags.urls')),
(r'^search/', include('haystack.urls')),
(r'^sentry/', include('sentry.web.urls')),
(r'^news/', include('news.urls')),
(r'^api/', include('contrib.api.urls')), #api is in the testing phase leaving commented out for release
(r'^$', 'recipe.views.index'),

Expand Down

0 comments on commit a1d76ff

Please sign in to comment.