On Thu, Apr 18, 2013 at 8:07 PM, Daniele Procida <[email protected]> wrote:
> < > https://docs.djangoproject.com/en/dev/ref/contrib/messages/#displaying-messages> > could be expand to provide more guidance on how to implement this. > > For example, should messages be dealt with at the site template level, or > at the application template level? > > This is particularly relevant if one is developing a re-usable application. > > If an application's templates include messages code, then if that > application is used in a site that also has messages code in its base > templates, messages will be displayed twice. Using the site templates to > handle messages also means they can be presented consistently. > > On the other hand, not handling messages in the applications' templates > means forgoing the opportunity to customise their appearance, location and > the headings under which they appear. > > So should the advice be to treat message template output as a site-wide > feature, or as an application-related feature? > I'm not sure I see why this is something that Django needs to state an opinion on. Django deals with the issue at the server side - making sure that messages can be captured, stored and retrieved as necessary. The decision of how to display those messages really is up to the end user. I can see legitimate reasons why you'd want to take both approaches you describe, and the decision to use one or the other really depends on the templates and visual layout of the site under discussion. The re-usable application argument is one of the reasons why James Bennett (and others) have advocated that reusable apps shouldn't provide default templates. Sample templates, perhaps, but not ones that are used by default. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
