Hello! I am writing my first app for django, areticles. All tutorials read. I want from app: - add articles by users for readding by admin and publish them or del - archive by months - insert last 5 bref_articles to index page of site
Create a model ____________ from django.core import meta class Article(meta.Model): headline = meta.CharField(maxlength=100) bref_article = meta.TextField(help_text="Can use HTML tags") body_article = meta.TextField(help_text="Can use HTML tags") pub_date = meta.DateTimeField('date published') author = meta.CharField(maxlength=100) publish = meta.BooleanField('done') def was_published_today(self): return self.pub_date.date() == datetime.date.today() was_published_today.short_description = 'Was published today' def __repr__ (self): return self.headline class META: admin = meta.Admin( list_display = ('pub_date', 'headline', 'author', 'was_published_today'), list_filter = ['pub_date'], search_fields = ['author', 'headline', 'bref_article', 'body_article'], ) Writing urls _____________ from django.conf.urls.defaults import * urlpatterns = patterns('dial.apps.articles.views', (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'detail'), (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month'), (r'^(?P<year>\d{4})/$', 'archive_year'), (r'^/?$', 'index'), ) Writing views _____________ How must looks views for my tasks? -- Всего наилучшего! greg [at] anastasia [dot] ru Григорий.