Permalink
Browse files

admin

  • Loading branch information...
1 parent 51564c1 commit 925702401ff500a37f0022507096a86040a2f58e @vvangelovski committed Dec 26, 2011
@@ -1,2 +1,14 @@
-from django.contrib.admin import ModelAdmin
+from django.contrib.admin import ModelAdmin, site
from models import Topic, Post, Subscription
+
+class TopicAdmin(ModelAdmin):
+ pass
+
+class SubscriptionAdmin(ModelAdmin):
+ pass
+
+
+
+site.register(Topic, TopicAdmin)
+site.register(Subscription, SubscriptionAdmin)
+
@@ -4,14 +4,26 @@
class Topic(models.Model):
title = models.CharField(max_length = 255)
+ def __unicode__(self):
+ return self.title
+
class Post(models.Model):
- topic = models.ForeignKey(Post)
+ topic = models.ForeignKey(Topic)
content = models.TextField()
+ def __unicode__(self):
+ return self.topic.title
+
class Subscription(models.Model):
subscriber = models.ForeignKey(User)
topic = models.ForeignKey(Topic)
+ def __unicode__(self):
+ return "%s - %s"%(self.subscirber.username, topic.title)
+
class ReplyAddress(models.Model):
subscription = models.ForeignKey(Subscription)
address = models.EmailField()
+
+ def __unicode__(self):
+ return self.address
@@ -117,7 +117,7 @@
'django.contrib.staticfiles',
'webapp.forum',
# Uncomment the next line to enable the admin:
- # 'django.contrib.admin',
+ 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
View
Binary file not shown.
@@ -1,8 +1,8 @@
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
+from django.contrib import admin
+admin.autodiscover()
urlpatterns = patterns('',
# Examples:
@@ -13,5 +13,5 @@
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
- # url(r'^admin/', include(admin.site.urls)),
+ url(r'^admin/', include(admin.site.urls)),
)

0 comments on commit 9257024

Please sign in to comment.