Hi and welcome to django.

In regards to question 1, it looks like you are missing something. The
request object, that you have as parameter in your function, is used
in the views.py file. The object has a lot of the info that you need,
like the user, the post data if any ect. If you want to make a
functions like the one above, you dont need the request object in it,
as you dont use it in the function and isn't required.
I'm not sure what you mean with getting the output as html. Once you
get it to a template, it wont matter how it got generated, as long as
you dont escape the html chars.

If you want to import fx all functions in a fille, you can do it in
different ways.
You could do:
from myproject.globalValues import *
This would give you the functions like the ocultarEstado in the global
namespace, so you could call it by typing ocultarEstado(...). Another
way to import would be to do,
from myproject import globalValues as global
this would give you all the functions in the globalValues file on
"global", so you could do, global.ocultarEstado(...). You could change
the name after "as" into anything you like.

~Briel

On 9 Mar., 17:11, Julián C. Pérez <jcp...@gmail.com> wrote:
> hi everyone from colimbia
> i'm new on django... so far, i love it... i'm very used to php, but
> the solution with django/python is just awesome
> i have started a project and i've been catching up with the basics...
> right now i have 2 doubts...
>
> 1. i created a file called 'globalValues.py' in the root folder of my
> project... the purpose?? to put in there all python functions created
> by me and called frequently among the code, and also to put some html
> 'shortcuts' to common stuff...
> the code in that file so far is next:
> # ----------
> # start code globalValues.py
> def ocultarEstado(request):
>         return { 'ocultarEstado' : '<p>hi u user!</p>' }
> # end code
> # ----------
> very short right now jeje
> my question about it: how can i make 'ocultarEstado' function to
> output the string as html, instead of its raw representation??
>
> 2. said all above, in my 'settings.py' file there is the import as it
> follows:
> # ----------
> TEMPLATE_CONTEXT_PROCESSORS = (
>         'django.core.context_processors.auth',
>         'django.core.context_processors.debug',
>         'django.core.context_processors.i18n',
>         'django.core.context_processors.media',
>         'myproject.globalValues.ocultarEstado',
> )
> # ----------
> my question here: how can i import all functions inside 'globalValues'
> file with one call?? -i'm looking for a "myproject.globalValues.*"
> kind of expression"- making every function calling with an entry is
> quite large...
>
> thank u all!
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to