first, I have searched in this group as "settings". "global
constant"...etc, but i don't think I have got what I need. ;(

well, I want to define some global constant, like:

MAX_UNIT_FOR_ONE_USER  = 100

then I want to use this constant in all the applications of my whole
project, in my views.py, not the templates.

the main purpose for this is to test if my settings of users are proper
or not, then I can have some convenient way to adjust.

I think it's a common way in C or C++ project to do like this, just
don't know how to do it in Django. I have tried to put
"MAX_UNIT_FOR_ONE_USER  = 100" in the settings.py, and used it in
views, but got an error as "global name MAX_UNIT_FOR_ONE_USER  not
defined", etc...

And, I have tried to start a new app and defined all such global var in
the models (named Global_Var). it works, but every time when i want to
retrive these vars, i have to use like

xxx = Global_Var.objects.get(var_name='MAX_UNIT_FOR_ONE_USER').number

really don't think it's a good way. and because I don't have to store
such global vars in my database, I prefer to set them just in my
codes...

thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to