views:

292

answers:

1

I have been intending to use django-notification in my django app.

The docs are a little sparse for someone with my limited level of experience. I need a couple of clarifications about its usage.

  • In the project's usage.txt, under the section "Creating Notice Types" it says:

You need to call create_notice_type(label, display, description) once to create the notice types for your application in the database.

After debating this with myself quite a lot, I feel like I don't really "need" to do that. The objective is to create records for notice types in the database, so I can very well do that using django-notification's options in the admin section. Am I right?

I think create_notice_type is useful when one is distributing apps so that they are pluggable.

  • In the project's usage.txt, under the section "Notification templates" it says:

There are four different templates that can to be written for the actual content of the notices: .......... Each of these should be put in a directory on the template path called notification/<notice_type_label>/<template_name>. If any of these are missing, a default would be used.

What are these default templates? Where do they need to reside? Is putting the four templates mentioned in the docs in a "notification" directory in the template loader path sufficient?

  • As can be seen in the project's views.py line 43, the template "notices.html" is used. Line 53 uses "single.html" . But the project does not provide these template anywhere in its directory structure. What is going on there?
+1  A: 

I can very well do that using django-notification's options in the admin section. Am I right?

Yes. You can add or remove them via the admin later. It just makes it easy to use the same notice types in your code without worrying about getting them exactly right every time. For example if you are using the same notice types and constantly resetting your app while you're developing (like me) this can be a big time saver.

What are these default templates? Where do they need to reside? Is putting the four templates mentioned in the docs in a "notification" directory in the template loader path sufficient?

django-notifications includes most of the basic templates you need in notification/templates, however it is still missing single.html. To use your own templates, put them in your usual template directory under /template-path/notification/template_name. This will override the defaults. You can also add granular templates for each notice type by using the format /template-path/notification/noticelabel_noticeformat.

Brian Immel
It is also missing notices.html. I have since been successfully using django-notification, thanks to lots of browsing through the code and also http://bitbucket.org/cleemesser/django-notification-clm/People intending to use django-notification also need to be aware of the emit_notices command extension. This is similar to what one does with the django-mailer app's command extensions. django-mailer, by the same author, is also an excellent app, and somewhat better documented, and these two apps really compliment each other. Use both.
chefsmart
Thanks for the pointer to the minimal project. <rhetorical>Why don't more django apps include examples of the templates they expect?</rhetorical>
muudscope