Permalink
Browse files

Fixed #9. Create a default blog during syncdb that is associated to t…

…he current site.

git-svn-id: file:///Users/brian/Backups/S3/backups/Wednesday/brian/svn/djog/trunk@50 95ab7de8-677b-4562-a266-b8acc9dd993c
  • Loading branch information...
1 parent df1a322 commit 51851c96d814186a7feeede05fac5f9cdbc36b9b @brosner committed Oct 23, 2007
Showing with 18 additions and 0 deletions.
  1. +18 −0 djog/management.py
View
@@ -0,0 +1,18 @@
+
+from django.dispatch import dispatcher
+from django.db.models import signals
+from django.contrib.sites.models import Site
+
+from djog.models import Blog
+from djog import models as blog_app
+
+def create_default_blog(app, created_models, verbosity):
+ if Blog in created_models and Site in created_models:
+ if verbosity >= 2:
+ print 'Creating default Blog object'
+ # assign the blog to the current site
+ s = Site.objects.get_current()
+ b = Blog(site=s, title='Default Blog')
+ b.save()
+
+dispatcher.connect(create_default_blog, sender=blog_app, signal=signals.post_syncdb)

0 comments on commit 51851c9

Please sign in to comment.