Ladies and gentleman,

I am new to Django and would really love to have a solution for this:

My goal is to share generated settings between my views/models and 
templates, without repeating myself.

Right now I have following code, where the problem appears:

#MY_CONTEXT_PROCESSOR.PY
from django.conf import settings

def setDataToContext (request):
    """
        Send settings to context of tempalte
    """

    #GENERATED STUFF
    #Prepare common Objects
    main_category = Category.objects.get(id=1)

    return {
        'settings': settings, # Global Django Settings
        'MAIN_CATEGORY': main_category, # Make category available in 
template - Question: How do I make this available in views/models as 
settings.MAIN_CATEGORY?
    }


The main question is:

*How can I make the generic constant MAIN_CATEGORY available in 
views/models as settings.MAIN_CATEGORY without repeating myself?*
I am really looking forward to see your solutions.

Kind regards
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb76aeb9-bc51-4b1a-918d-db6d29956d08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to