# Django-Notification Creating Notice Types issues

I was setting up Django-Notification for a project, and I was trying to create notice types like it mentions on their wiki . Their wiki says that you should add the following code to your management.py file in your app.

from django.conf import settingsfrom django.db.models import signalsfrom django.utils.translation import ugettext_noop as _if “notification” in settings.INSTALLED_APPS:  from notification import models as notification  def create_notice_types(app, created_models, verbosity, *kwargs):      notification.create_notice_type(“friends_invite”, _(“Invitation Received”), _(“you have received an invitation”))      notification.create_notice_type(“friends_accept”, _(“Acceptance Received”), _(“an invitation you sent has been accepted”))  signals.post_syncdb.connect(create_notice_types, sender=notification)else:  print “Skipping creation of NoticeTypes as notification app not found”
After trying lots of different things (dropping database and re syncing,etc) the management file wasn’t getting picked up and it was quite annoying.

It turns out that if you have written custom management extensions and you have a management directory under your application it will ignore the management.py file all together. So you need to add the code to the app/management/init.py file instead.

Once you have added the files you need to resync (make sure you remove notification_
tables first).

This makes total sense now, and I guess I shouldn’t have taken the directions to literaly.

If you still can’t get it to work, the other option is to just create a fixture and load the data that way.

Share