Wich OS for develop?

2018-01-02 Thread Julián Melero Hidalgo
Hi all.I don't have experience with django, so I have so much questions.The questions are:Wich OS is better to develop with django?Windows is a bad option?Can I use Win for develop and GNU/Linux as a server?What IDE (atom, VS Code, vim,etc..)you use?Thank you!!!



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2be2cccf-461a-40f7-a7d6-0ba65c1c5acd%40email.android.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql-python in Windows

2017-12-11 Thread Julián Melero Hidalgo

I resolved adding to manage.py:import pymysqlpymysql.install_as_MySQLdb():D :DEl 11 de diciembre de 2017 a las 1:26 Egor Smolyakov escribió:Hello.Take a look at https://pypi.python.org/pypi/PyMySQL/0.7.11On 10/12/2017, Julián Melero Hidalgo wrote:Hi all!I'm trying to install pip install mysql-python, but it doesn't works.I'm using Win10, Xampp, Python 3.How can I install it?Thanks!!--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 anemail to django-users+unsubscr...@googlegroups.com.To post to this group, send email to django-users@googlegroups.com.Visit this group at https://groups.google.com/group/django-users.To view this discussion on the web visithttps://groups.google.com/d/msgid/django-users/510fd5bd-1e89-4550-bbe5-45d36264db92%40email.android.com.For more options, visit https://groups.google.com/d/optout.-- Kind Regards, Egor Smolyakov.-- 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 django-users+unsubscr...@googlegroups.com.To post to this group, send email to django-users@googlegroups.com.Visit this group at https://groups.google.com/group/django-users.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACL14xqimS7rbnsbcwJHTQsrLa5CpxgNVdL_%2Bv45fObNz7GfdQ%40mail.gmail.com.For more options, visit https://groups.google.com/d/optout.
 



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1867401167.56074.1512987281836%40email.1and1.es.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql-python in Windows

2017-12-11 Thread Julián Melero Hidalgo

Hi.I installed it. But when I run "runserver" I have this error: "Did you install mysqlclient or MySQL-python?".:(El 11 de diciembre de 2017 a las 1:26 Egor Smolyakov escribió:Hello.Take a look at https://pypi.python.org/pypi/PyMySQL/0.7.11On 10/12/2017, Julián Melero Hidalgo wrote:Hi all!I'm trying to install pip install mysql-python, but it doesn't works.I'm using Win10, Xampp, Python 3.How can I install it?Thanks!!--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 anemail to django-users+unsubscr...@googlegroups.com.To post to this group, send email to django-users@googlegroups.com.Visit this group at https://groups.google.com/group/django-users.To view this discussion on the web visithttps://groups.google.com/d/msgid/django-users/510fd5bd-1e89-4550-bbe5-45d36264db92%40email.android.com.For more options, visit https://groups.google.com/d/optout.-- Kind Regards, Egor Smolyakov.-- 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 django-users+unsubscr...@googlegroups.com.To post to this group, send email to django-users@googlegroups.com.Visit this group at https://groups.google.com/group/django-users.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACL14xqimS7rbnsbcwJHTQsrLa5CpxgNVdL_%2Bv45fObNz7GfdQ%40mail.gmail.com.For more options, visit https://groups.google.com/d/optout.
 



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1058431135.54869.1512986204913%40email.1and1.es.
For more options, visit https://groups.google.com/d/optout.


Mysql-python in Windows

2017-12-10 Thread Julián Melero Hidalgo
Hi all!I'm trying to install pip install mysql-python, but it doesn't works.I'm using Win10, Xampp, Python 3.How can I install it?Thanks!!



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/510fd5bd-1e89-4550-bbe5-45d36264db92%40email.android.com.
For more options, visit https://groups.google.com/d/optout.


Django with apache and php

2017-11-30 Thread Julián Melero Hidalgo

Hi all.I'm new in Django. I have a question.I have a server with apache and php. I would like to use django in this server.How can I config django in apache?Can I use django in the same port that php projects? How?Thank you a lot!Julián Melero.
 



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/331141966.241230.1512039364335%40email.1and1.es.
For more options, visit https://groups.google.com/d/optout.


Re: Interrelated form fields

2009-11-03 Thread Julián C . Pérez

Nice discussion :D
Any help on Ajax methods or something to achieve this?

On Oct 30, 4:25 am, bruno desthuilliers
 wrote:
> On 29 oct, 18:33, Daniel Roseman  wrote:
>
> > On Oct 29, 4:42 pm, bruno desthuilliers
>
> 
>
> >  wrote:
> > > (FWIW and IIRC, the appropriate english term is 'Customer' - please
> > > someone correct me if I'm wrong)
>
> > OK... the French word 'client' maps to both 'client' and 'customer'. A
> > lawyer, doctor, accountant etc would have clients; a shop has
> > customers. Sometimes you can have both: a newspaper, for example,
> > would have clients who buy advertising, but customers who buy the
> > paper.
>
> 
>
> Thank you Daniel for the clarification and correction !-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Interrelated form fields

2009-10-29 Thread Julián C . Pérez

Hi all
I have a question to make
I'm tryng to build a form using the following models:

---
in models.py

class Client(models.Model):
   user = models.ForeignKey(User, verbose_name=u'associated user')
   telephone = models.CharField(u'Telephone number', max_length=33,
blank=False, null=False)

class Appointment(models.Model):
   client= models.ForeignKey(Client, verbose_name=u'associated
client')
   date = models.DateField('Booked to', blank=False, null=False)

---

As you see, the Appointment model depends on the Client one
So, I want a form showing at first the client's select box according
to the DB records of model Client
As soon as one client is selected, I want the form to show only the
appointments booked to him

How can I make that happen?
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and ZSI

2009-09-01 Thread Julián C . Pérez

Thanks

On Aug 31, 3:22 pm, Antoni Aloy <antoni.a...@gmail.com> wrote:
> 2009/8/31 Julián C. Pérez <jcp...@gmail.com>:
>
>
>
> > Anyone has experience with using web services in Django??
> > I mean, not necessarily with ZSI but others methods...
>
> Yes, we have many of the working. But this is no a Django issue is
> more a Python programming one. You can access to Soap web services
> using ZSI, SUDS, Soappy or whatever you like to use.
>
> Isolate the web service client and use the parts you need. We have
> worked with ZSI mainly, but actually we're moving to Suds.
>
> To act a a server we prefer to simplify and we're using xml over http
> or REST services. Both live perfectly with Django.
>
> --
> Antoni Aloy López
> Blog:http://trespams.com
> Site:http://apsl.net
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django and ZSI

2009-08-31 Thread Julián C . Pérez

Anyone has experience with using web services in Django??
I mean, not necessarily with ZSI but others methods...

On Aug 31, 11:56 am, Julián C. Pérez <jcp...@gmail.com> wrote:
> Hi you all
> I'm trying to serve a simple web service using ZSI
> Anyone how can I configure an app's urls and views files to do this??
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template tag question

2009-08-31 Thread Julián C . Pérez

Hi
I use Django 1.0 and I define a template function like...
---
from django import template
register = template.Library()
def doSomething(param1, param2):
   # Do something like...
   return str(param1)+''+str(param2)
register.simple_tag(doSomething)
---
to use that in template system, assuming a and b are in context...
---
{% doSomething a b %}

---
Hope it helps you out
;)

On Aug 31, 12:31 pm, Bobby Roberts  wrote:
> hi group.  I"ve got an issue i'm needing help with.  I have two
> variables, a and b in my template and I need to pass those to a single
> template tag so I can process them and return a result to the
> template.  Is there a way to pass more than one variable to a template
> tag... if so, how?
>
> thanks in advance,
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django and ZSI

2009-08-31 Thread Julián C . Pérez

Hi you all
I'm trying to serve a simple web service using ZSI
Anyone how can I configure an app's urls and views files to do this??
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Get current user outside a view / without an request object

2009-08-06 Thread Julián C . Pérez

Bingo!!!
:D
I follow this:
http://oebfare.com/blog/2008/feb/23/changing-modelchoicefield-queryset/
and now I'm happy with mi desired current user based queryset
Thank you all!

BTW, my form class finally looks like...
---
class SendMessageForm(forms.Form):

recipientUser = ShowValidContactList
(queryset=None,label=u'Send to')
messageSubject= forms.CharField(label=u'Subject')
messageContent = forms.CharField
(label=u'Content',widget=forms.Textarea())

def __init__(self, inputUser, *args, **kwargs):
   self.user= inputUser
   super(SendMessageForm, self).__init__(*args, **kwargs)
   self.fields['recipientUser'].queryset = # Anything with
the current user, in this case 'self.user'
---

On Aug 6, 11:14 am, Julián C. Pérez <jcp...@gmail.com> wrote:
> Thanks for reply, Paulo
> But if I...
> ---
> class SendMessageForm(forms.Form):
>
>         recipientUser = ShowValidContactList(currentUser=self.user,
> label=u'Send to')
>         messageSubject= forms.CharField(label=u'Subject')
>         messageContent = forms.CharField(label=u'Content',
> widget=forms.Textarea())
>
>         def __init__(self, inputUser, *args, **kwargs):
>                self.user= inputUser
>                super(SendMessageForm, self).__init__(*args, **kwargs)
> ---
> the 'recipientUser = ShowValidContactList(currentUser=self.user,
> label=u'Send to')' raises error because of that 'self.user' ('self'
> wouldn't be defined and be out of scope)
>
> On Aug 6, 11:09 am, Paulo Almeida <igcbioinformat...@gmail.com> wrote:
>
> > It doesn't have to be a callable, you can just do something like:
>
> > recipientUser = ShowValidContactList(currentUser=self.currentUser)
>
> > I never used that kwargs.pop function (I didn't know you could do that),
> >  but I have code like this:
>
> > class ExperimentForm(ModelForm):
> >     """ Generate form to handle experiment information. """
> >     def __init__(self, user, *args, **kwargs):
> >         super(ExperimentForm, self).__init__(*args, **kwargs)
> >         try:
> >             preferences = Preferences.objects.get(user=user)
>
> > That last 'user' is just what came from the function call in the view.
>
> > - Paulo
>
> > 2009/8/6 Julián C. Pérez <jcp...@gmail.com>
>
> > > My real problem it that the field should looks like:
> > > ---
> > > recipientUser = ShowValidContactList(currentUser=_something_,
> > > label=u'Send to')
> > > ---
> > > and if I have a form's init method like...
> > > ---
> > > def __init__(self, *args, **kwargs):
> > >    self.currentUser = kwargs.pop('currentUser', None)
> > >    super(SendMessageForm, self).__init__(*args, **kwargs)
> > > ---
> > > it won't change the current user already defined in the field
>
> > > Now, I want to make something like...
> > > ---
> > > recipientUser = ShowValidContactList(currentUser=getCurrentUser,
> > > label=u'Send to')
> > > ---
> > > where 'getCurrentUser' is a callable function similar to:
> > > ---
> > > def get_image_path(instance, filename):
> > >    return 'photos/%s/%s' % (instance.id, filename)
>
> > > class Photo(models.Model):
> > >    image = models.ImageField(upload_to=get_image_path)
> > > ---
> > > how can I do that?
>
> > > On Aug 6, 9:58 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> > > > On Aug 6, 3:34 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > > > > Hi
> > > > > I tried doing that...
> > > > > But it does not work
> > > > > For example, if I do something like...
> > > > > ---
> > > > > class SendMessageForm(forms.Form):
> > > > >         recipientUser = ShowValidContactList(label=u'Send to')
> > > > >         messageSubject= forms.CharField(label=u'Subject')
> > > > >         messageContent = forms.CharField
> > > > > (label=u'Content',widget=forms.Textarea())
> > > > >         def __init__(self, currentUser):
> > > > >                 self.currentUser = currentUser
> > > > >                 super(SendMessageForm, self).__init__(*args, **kwargs)
> > > > > ---
> > > > > that init method in my custom form class won't change anything in the
> > > > > already defined ShowValidContactList field
>
> > > > Because you are clobbering the existing parameters to __init__. You
> > > > should do it like this:
>
> > > > def __init__(self, *args, **kwargs):
> > > >     self.currentUser = kwargs.pop('currentUser', None)
> > > >     super(SendMessageForm, self).__init__(*args, **kwargs)
>
> > > > --
> > > > DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Get current user outside a view / without an request object

2009-08-06 Thread Julián C . Pérez

Thanks for reply, Paulo
But if I...
---
class SendMessageForm(forms.Form):

recipientUser = ShowValidContactList(currentUser=self.user,
label=u'Send to')
messageSubject= forms.CharField(label=u'Subject')
messageContent = forms.CharField(label=u'Content',
widget=forms.Textarea())

def __init__(self, inputUser, *args, **kwargs):
   self.user= inputUser
   super(SendMessageForm, self).__init__(*args, **kwargs)
---
the 'recipientUser = ShowValidContactList(currentUser=self.user,
label=u'Send to')' raises error because of that 'self.user' ('self'
wouldn't be defined and be out of scope)

On Aug 6, 11:09 am, Paulo Almeida <igcbioinformat...@gmail.com> wrote:
> It doesn't have to be a callable, you can just do something like:
>
> recipientUser = ShowValidContactList(currentUser=self.currentUser)
>
> I never used that kwargs.pop function (I didn't know you could do that),
>  but I have code like this:
>
> class ExperimentForm(ModelForm):
>     """ Generate form to handle experiment information. """
>     def __init__(self, user, *args, **kwargs):
>         super(ExperimentForm, self).__init__(*args, **kwargs)
>         try:
>             preferences = Preferences.objects.get(user=user)
>
> That last 'user' is just what came from the function call in the view.
>
> - Paulo
>
> 2009/8/6 Julián C. Pérez <jcp...@gmail.com>
>
>
>
> > My real problem it that the field should looks like:
> > ---
> > recipientUser = ShowValidContactList(currentUser=_something_,
> > label=u'Send to')
> > ---
> > and if I have a form's init method like...
> > ---
> > def __init__(self, *args, **kwargs):
> >    self.currentUser = kwargs.pop('currentUser', None)
> >    super(SendMessageForm, self).__init__(*args, **kwargs)
> > ---
> > it won't change the current user already defined in the field
>
> > Now, I want to make something like...
> > ---
> > recipientUser = ShowValidContactList(currentUser=getCurrentUser,
> > label=u'Send to')
> > ---
> > where 'getCurrentUser' is a callable function similar to:
> > ---
> > def get_image_path(instance, filename):
> >    return 'photos/%s/%s' % (instance.id, filename)
>
> > class Photo(models.Model):
> >    image = models.ImageField(upload_to=get_image_path)
> > ---
> > how can I do that?
>
> > On Aug 6, 9:58 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> > > On Aug 6, 3:34 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > > > Hi
> > > > I tried doing that...
> > > > But it does not work
> > > > For example, if I do something like...
> > > > ---
> > > > class SendMessageForm(forms.Form):
> > > >         recipientUser = ShowValidContactList(label=u'Send to')
> > > >         messageSubject= forms.CharField(label=u'Subject')
> > > >         messageContent = forms.CharField
> > > > (label=u'Content',widget=forms.Textarea())
> > > >         def __init__(self, currentUser):
> > > >                 self.currentUser = currentUser
> > > >                 super(SendMessageForm, self).__init__(*args, **kwargs)
> > > > ---
> > > > that init method in my custom form class won't change anything in the
> > > > already defined ShowValidContactList field
>
> > > Because you are clobbering the existing parameters to __init__. You
> > > should do it like this:
>
> > > def __init__(self, *args, **kwargs):
> > >     self.currentUser = kwargs.pop('currentUser', None)
> > >     super(SendMessageForm, self).__init__(*args, **kwargs)
>
> > > --
> > > DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Get current user outside a view / without an request object

2009-08-06 Thread Julián C . Pérez

My real problem it that the field should looks like:
---
recipientUser = ShowValidContactList(currentUser=_something_,
label=u'Send to')
---
and if I have a form's init method like...
---
def __init__(self, *args, **kwargs):
self.currentUser = kwargs.pop('currentUser', None)
super(SendMessageForm, self).__init__(*args, **kwargs)
---
it won't change the current user already defined in the field

Now, I want to make something like...
---
recipientUser = ShowValidContactList(currentUser=getCurrentUser,
label=u'Send to')
---
where 'getCurrentUser' is a callable function similar to:
---
def get_image_path(instance, filename):
return 'photos/%s/%s' % (instance.id, filename)

class Photo(models.Model):
image = models.ImageField(upload_to=get_image_path)
---
how can I do that?

On Aug 6, 9:58 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 6, 3:34 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
>
>
>
> > Hi
> > I tried doing that...
> > But it does not work
> > For example, if I do something like...
> > ---
> > class SendMessageForm(forms.Form):
> >         recipientUser = ShowValidContactList(label=u'Send to')
> >         messageSubject= forms.CharField(label=u'Subject')
> >         messageContent = forms.CharField
> > (label=u'Content',widget=forms.Textarea())
> >         def __init__(self, currentUser):
> >                 self.currentUser = currentUser
> >                 super(SendMessageForm, self).__init__(*args, **kwargs)
> > ---
> > that init method in my custom form class won't change anything in the
> > already defined ShowValidContactList field
>
> Because you are clobbering the existing parameters to __init__. You
> should do it like this:
>
> def __init__(self, *args, **kwargs):
>     self.currentUser = kwargs.pop('currentUser', None)
>     super(SendMessageForm, self).__init__(*args, **kwargs)
>
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Get current user outside a view / without an request object

2009-08-06 Thread Julián C . Pérez

Hi
I tried doing that...
But it does not work
For example, if I do something like...
---
class SendMessageForm(forms.Form):
recipientUser = ShowValidContactList(label=u'Send to')
messageSubject= forms.CharField(label=u'Subject')
messageContent = forms.CharField
(label=u'Content',widget=forms.Textarea())
def __init__(self, currentUser):
self.currentUser = currentUser
super(SendMessageForm, self).__init__(*args, **kwargs)
---
that init method in my custom form class won't change anything in the
already defined ShowValidContactList field

I also tried threadlocal's approach... but it didn't work either and
it's a weird way to do that...
I'm gonna go in a different direction, inspired by similar former
problem
Thank you alll, now I'll report with my status

On Aug 6, 1:40 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 6, 2:24 am, Julián C. Pérez <jcp...@gmail.com> wrote:
>
>
>
> > Hi everyone
> > I'm in trouble because of a form class
> > I have a form class with attributes defined, but with one thing:
> > One of the attributes requires the current user, or al least its
> > username
>
> > The form definition in as shown below:
> > ---
> > class SendMessageForm(forms.Form):
> >         recipientUser = ShowValidContactList(label=u'Send to')
> >         messageSubject= forms.CharField(label=u'Subject')
> >         messageContent = forms.CharField(label=u'Content',
> > widget=forms.Textarea())
> > ---
>
> > As you can tell I'm trying to make a 'Send message' form to make
> > message sending available in my project... but the recipient user must
> > be in the contacts list of the current user...
> > The 'recipientUser' field is a ShowValidContactList
> > (forms.ModelChoiceField) instance... so it works with a fixed queryset
> > based on that user (the currently logged-in one)
>
> > My problem is that... how can I get the current user information
> > outside a view and without request objects??
> > Or... how can I make that form works with a different approach??
>
> > Any help would be appreciate!
>
> This is asked frequently on this group. The answer is to override the
> form's __init__ method and pass the request in there, and store it on
> a form attribute for later use.
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Get current user outside a view / without an request object

2009-08-05 Thread Julián C . Pérez

Hi everyone
I'm in trouble because of a form class
I have a form class with attributes defined, but with one thing:
One of the attributes requires the current user, or al least its
username

The form definition in as shown below:
---
class SendMessageForm(forms.Form):
recipientUser = ShowValidContactList(label=u'Send to')
messageSubject= forms.CharField(label=u'Subject')
messageContent = forms.CharField(label=u'Content',
widget=forms.Textarea())
---

As you can tell I'm trying to make a 'Send message' form to make
message sending available in my project... but the recipient user must
be in the contacts list of the current user...
The 'recipientUser' field is a ShowValidContactList
(forms.ModelChoiceField) instance... so it works with a fixed queryset
based on that user (the currently logged-in one)

My problem is that... how can I get the current user information
outside a view and without request objects??
Or... how can I make that form works with a different approach??


Any help would be appreciate!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Managing settings.py from admin site

2009-07-06 Thread Julián C . Pérez

Thank you, Graham
In fact... my post was just a wondering, maybe to use on personal
projects... because it would be risky in a production enviroment
Right now best thing I could do is to keep clean and isolated the
settings file

On Jul 2, 6:22 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Jul 3, 9:11 am, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > Hi everyone
> > I have a doubt...
> > Is it possible to edit or customize -not delete- variables created in
> >settings.pyfrom theadminsite of my application??
> > I mean, in order to control the whole site from web interface instead
> > of manually editingsettings.py
> > I hope I made myself clear...
> > Any idea??
>
> The only way you could do it is to rewrite thesettings.pyfile and
> then trigger a restart of the web server. If you were using daemon
> mode of mod_wsgi, you could also just trigger restart of the specific
> web application instance by updating modification time on the WSGI
> script file used as entry point for the application.
>
> Note that the safest thing to do would be to write new settings into
> new file and then atomically rename file so as to replace existing
> file. This avoids problem of half modified file being picked up by
> newly started web server/application process.
>
> Finally, do be aware that you would need to have really good error
> checking on inputs because any small stuff up could lock you out of
> your site. In some respects you might be better off having a separate
> application instance for modifying the file and have that run in
> separate mod_wsgi daemon process. In other words, you are never
> modifying your ownsettings.pyfile, so the application you use to
> edit it will never break.
>
> Graham
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Managing settings.py from admin site

2009-07-02 Thread Julián C . Pérez

Hi everyone
I have a doubt...
Is it possible to edit or customize -not delete- variables created in
settings.py from the admin site of my application??
I mean, in order to control the whole site from web interface instead
of manually editing settings.py
I hope I made myself clear...
Any idea??
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm customizing

2009-05-11 Thread Julián C . Pérez

anyone??
pleeease??
:D

On 10 mayo, 09:15, Julián C. Pérez <jcp...@gmail.com> wrote:
> anyone?? any help??
> :)
>
> > hi all
> > something like this had already been 
> > reported:http://code.djangoproject.com/ticket/6138
>
> > i tried sean's solutions but nothing happens...
> > stand by...
> > ;)
>
> > On May 8, 7:25 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > > thank you,s ean
> > > i will try
> > > ahh one thing i'd like to comment...
> > > when creating an ProfileForm object I even give it the class as an
> > > argument like this:
> > > ...
> > > profile, created = Profile.objects.get_or_create(user=request.user)
> > > myProfileForm = ProfileForm(request.POST, instance=profile,
> > > error_class=DivErrorList)
> > > ...
> > > but nothing happens... that object still uses the default error class
>
> > > another question on my mind...
> > > how can i assing to that form a custom class??
> > > i mean, to create something like:
> > > ...
> > > 
> > > ...
> > > i'd like to achieve that in order to control those fields using jquery
> > > -for validation reasons
>
> > > thank you all!
>
> > > On May 8, 12:13 pm, Sean Brant <brant.s...@gmail.com> wrote:
>
> > > > Try this, not tested but it might work.
>
> > > > class ProfileForm(forms.ModelForm):
> > > >     def __init__(self, *args, **kwargs):
> > > >         self.error_class = DivErrorList
> > > >         super(ProfileForm, self).__init__(*args, **kwargs)
>
> > > >     class Meta:
> > > >         model = P
> > > >         exclude = ('date', 'user', 'public')
>
> > > > When you override a class method you need to make sure to call super
> > > > inside it. This calls the classes parent method.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: ModelForm customizing

2009-05-10 Thread Julián C . Pérez

anyone?? any help??
:)

> hi all
> something like this had already been 
> reported:http://code.djangoproject.com/ticket/6138
>
> i tried sean's solutions but nothing happens...
> stand by...
> ;)
>
> On May 8, 7:25 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > thank you,s ean
> > i will try
> > ahh one thing i'd like to comment...
> > when creating an ProfileForm object I even give it the class as an
> > argument like this:
> > ...
> > profile, created = Profile.objects.get_or_create(user=request.user)
> > myProfileForm = ProfileForm(request.POST, instance=profile,
> > error_class=DivErrorList)
> > ...
> > but nothing happens... that object still uses the default error class
>
> > another question on my mind...
> > how can i assing to that form a custom class??
> > i mean, to create something like:
> > ...
> > 
> > ...
> > i'd like to achieve that in order to control those fields using jquery
> > -for validation reasons
>
> > thank you all!
>
> > On May 8, 12:13 pm, Sean Brant <brant.s...@gmail.com> wrote:
>
> > > Try this, not tested but it might work.
>
> > > class ProfileForm(forms.ModelForm):
> > >     def __init__(self, *args, **kwargs):
> > >         self.error_class = DivErrorList
> > >         super(ProfileForm, self).__init__(*args, **kwargs)
>
> > >     class Meta:
> > >         model = P
> > >         exclude = ('date', 'user', 'public')
>
> > > When you override a class method you need to make sure to call super
> > > inside it. This calls the classes parent method.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: ModelForm customizing

2009-05-08 Thread Julián C . Pérez

hi all
something like this had already been reported:
http://code.djangoproject.com/ticket/6138

i tried sean's solutions but nothing happens...
stand by...
;)

On May 8, 7:25 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
> thank you,s ean
> i will try
> ahh one thing i'd like to comment...
> when creating an ProfileForm object I even give it the class as an
> argument like this:
> ...
> profile, created = Profile.objects.get_or_create(user=request.user)
> myProfileForm = ProfileForm(request.POST, instance=profile,
> error_class=DivErrorList)
> ...
> but nothing happens... that object still uses the default error class
>
> another question on my mind...
> how can i assing to that form a custom class??
> i mean, to create something like:
> ...
> 
> ...
> i'd like to achieve that in order to control those fields using jquery
> -for validation reasons
>
> thank you all!
>
> On May 8, 12:13 pm, Sean Brant <brant.s...@gmail.com> wrote:
>
> > Try this, not tested but it might work.
>
> > class ProfileForm(forms.ModelForm):
> >     def __init__(self, *args, **kwargs):
> >         self.error_class = DivErrorList
> >         super(ProfileForm, self).__init__(*args, **kwargs)
>
> >     class Meta:
> >         model = P
> >         exclude = ('date', 'user', 'public')
>
> > When you override a class method you need to make sure to call super
> > inside it. This calls the classes parent method.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: ModelForm customizing

2009-05-08 Thread Julián C . Pérez

thank you,s ean
i will try
ahh one thing i'd like to comment...
when creating an ProfileForm object I even give it the class as an
argument like this:
...
profile, created = Profile.objects.get_or_create(user=request.user)
myProfileForm = ProfileForm(request.POST, instance=profile,
error_class=DivErrorList)
...
but nothing happens... that object still uses the default error class

another question on my mind...
how can i assing to that form a custom class??
i mean, to create something like:
...

...
i'd like to achieve that in order to control those fields using jquery
-for validation reasons

thank you all!

On May 8, 12:13 pm, Sean Brant  wrote:
> Try this, not tested but it might work.
>
> class ProfileForm(forms.ModelForm):
>     def __init__(self, *args, **kwargs):
>         self.error_class = DivErrorList
>         super(ProfileForm, self).__init__(*args, **kwargs)
>
>     class Meta:
>         model = P
>         exclude = ('date', 'user', 'public')
>
> When you override a class method you need to make sure to call super
> inside it. This calls the classes parent method.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ModelForm customizing

2009-05-08 Thread Julián C . Pérez

hi everyone
me again...
i need some help
i want to change the error_class in a modlefrom instance
the class looks like this:

# in a models.py file
1 .class ProfileForm(forms.ModelForm):
2.
3.  error_class = DivErrorList
4.
5.  class Meta:
6.  model = P
7.  exclude = ('date', 'user', 'public')

obviosly, the 3rd line doesn't do anything
i know that ProfileForm inherits from ModelFrom, which is a instance
of BaseModelForm (the class that has the 'error_class' attribute)
how can i change that attribute within my instance of ModelForm??
if i have to override the __init__... how can i do that to make all
things work??
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url template tag help

2009-05-03 Thread Julián C . Pérez

hi everyone...
i just took the easiest option i had
i rewrite my urls.py file completely again and by now... it works!
weird, i know...
i'm just appending the former urlpatterns lines i had, one by one,
testing every single of them
one by one... and working
thank u all so much!
;)

On May 3, 10:37 pm, Margie  wrote:
> Yup, I agree with you Kevin.  The django framework is very powerful.
> I started out with no webapp experience, and have also been able to
> build a very nice web app using django.  It took me considerably
> longer than a week to come up to speed, but I had zero background in
> html, css, sql, or web apps in general, so just understanding the
> basics of the webapp handshakes and how to work in an environment
> where I have no data structure state took me awhile to grock.  My app
> developed under django has such a nice symmetric, organized, feel.  I
> don't  have any hands on experience with what webapp development is
> like with out a framework like django, but I suspect it is a lot
> messier.   So I also feel like the dive in time ito learn some of the
> underlying detais of django source is well worth  it.
>
> Margie
>
> On May 1, 11:47 am, Kevin Audleman  wrote:
>
> > Malcom,
>
> > Cheers to that.
>
> > It's always hard to figure out what attitude you are conveying when
> > you post to a message board so I don't know how I sound in this
> > thread. Forgive me if I sound whiny or complainy, that is certainly
> > not my intent. Quite the contrary, my overall attitude toward Django
> > is that of pure awe. I've never worked with a framework that is so
> > logical, consistent, and powerful. I picked up the basics in a week
> > and suddenly feel empowered to create full-fledged web apps that can
> > do complex queries, handle form submission with full input validation
> > and cleaning, have a working security/permissions framework, etc.
> > Three cheers, mate!
>
> > I meant what I said about working with reverse url: complicated but
> > worth the effort. What's going on behind the scenes is no doubt
> > extremely complex, but the fact that I never have to hard-code a url
> > is huge. I take it as a challenge to put all the pieces together
> > myself.
>
> > Kevin
>
> > On May 1, 11:28 am, Malcolm Tredinnick 
> > wrote:
>
> > > On Fri, 2009-05-01 at 11:13 -0700, Kevin Audleman wrote:
>
> > > > > I can't explain any of this, but I've been thinking about your
> > > > > question since you posted it beause I know this type of error happens
> > > > > to me a lot (and indeed has been hard to debug), but I couldn't put my
> > > > > finger on remembering what my solution was.  It just happened, I fixed
> > > > > my syntax error, but still got reverseMatch error message.  Restarted
> > > > > the server, and it was gone.
>
> > > > Truly, Margie, this is the most inexplicable part of Django for me
> > > > too. I'll code up a template with a bunch of {% url app.view %}
> > > > statements which will work just fine. Then at some point I make some
> > > > change and *bam* I've got a reverse url lookup error. The solution is
> > > > not always obvious either. As I wrote earlier in this thread, at one
> > > > point I suddenly had to append the app name to the names of my url's
> > > > in urls.py. They had been working just fine, then something I changed
> > > > made them not work.
>
> > > At which point, working out "what changed" would be useful so that (a)
> > > you can avoid it next time and (b) if it's some kind of problem in
> > > Django, we can fix it. There is almost no magic going on in these sorts
> > > of situations.
>
> > > Certainly the error reporting from some of the URL resolving is a little
> > > weak and that's something we're going to fix at some point. Hopefully
> > > before 1.1 comes out. So bear with us for a little while longer on that
> > > front and, in the interim
>
> > > > I agree that restarting the server is crucial. Don't know why, but it
> > > > clears these types of things up.
>
> > > Because there's a lot of internal caching going on. In particular, files
> > > are imported once and then not imported again (since that would be
> > > blindingly inefficient). URL configuration files are read once by each
> > > process and the reverse lookups -- which take quite a bit of effort to
> > > determine -- are cached so that we don't have to do the work every
> > > single time.
>
> > > It's fairly logical that if you change something you will have to tell
> > > the code using that information that the on-disk versions have changed.
> > > Sure, you don't have to worry about the "compile" part of a normal
> > > development cycle when using Python very often, but there is some text
> > > -> bytecode compilation going on, whether converting to .pyc files or
> > > simply on the import into memory and there is other in-memory storage
> > > taking place. The development server spoils people a bit in this
> > > 

Re: Template tags and variables overlapping

2009-05-03 Thread Julián C . Pérez

okss
thank u all for your replies
i have a new question about it...

in order to make more portable my code, i like to create warepper
functions to anything...
i want to make a function -in this case a template tag- for creation
of links...

example:
{% createLink "a link to something" src "class attr" "id attr" "title
attri" %}
would output something like:
a
link to something

how can i make the 'src' input to be the result of url tag calling a
valid view??
i mean, something like:
{% createLink "a link to something" "{% url aValidView %}" "class
attr" "id attr" "title attri" %} # obviously that is wrong... just to
make my point
a link to something

any help would be appreciated
;)

On Apr 30, 2:51 pm, Sean Brant  wrote:
> If the tag excepts more than one argument you should be able to do
> something like this.
>
> {% sayHello "Robert and" currentname %}
>
> You would just need to figure out how best to break the bits up (a
> regex probably would work) and iterate over those bits resolving the
> variables to strings, keeping the strings normal strings.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Template tags and variables overlapping

2009-04-30 Thread Julián C . Pérez

jajaja i know
that what just a stupid example to make my point...
i plan to make more complex custom tags

On Apr 30, 12:11 pm, Lakshman Prasad <scorpion...@gmail.com> wrote:
> Why cant you just do something like
>
> {% sayHello " Hello Robert and " %} {{ currentname }}
>
> 2009/4/30 Julián C. Pérez <jcp...@gmail.com>
>
>
>
>
>
> > hi u all... again
> > this has become my first resource on getting help
> > a new doubt i have...
> > in templates...
> > i have a variable, let's say varOne -suposse it's equal to "Kathleen"
> > ... {{ currentName }} ...
> > and i have created a custom tag which takes an argument, called
> > sayHello
> > ... {% sayHello "Robert and Mary" %} ... > this would output 'Hello
> > Robert and Mary'
> > but if i do something like:
> > ... {% sayHello "Robert and {{ currentName }}" %} ... > this would
> > output 'Hello Robert and {{ currentName }}'
> > needless to say i want some output like 'Hello Robert and Kathleen'
>
> > how can i get this to work??
> > thank u all!
>
> --
> Regards,
> Lakshman
> becomingguru.com
> lakshmanprasad.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Template tags and variables overlapping

2009-04-30 Thread Julián C . Pérez

hi u all... again
this has become my first resource on getting help
a new doubt i have...
in templates...
i have a variable, let's say varOne -suposse it's equal to "Kathleen"
... {{ currentName }} ...
and i have created a custom tag which takes an argument, called
sayHello
... {% sayHello "Robert and Mary" %} ... > this would output 'Hello
Robert and Mary'
but if i do something like:
... {% sayHello "Robert and {{ currentName }}" %} ... > this would
output 'Hello Robert and {{ currentName }}'
needless to say i want some output like 'Hello Robert and Kathleen'

how can i get this to work??
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
-~--~~~~--~~--~--~---



Re: url template tag help

2009-04-30 Thread Julián C . Pérez

anyone??
i can't get around this...
and i don't want to hard-code the urls in templates either
:(

On 30 abr, 09:20, Julián C. Pérez <jcp...@gmail.com> wrote:
> by now, i'll try to found some other way to create dynamic urls based
> on the views...
> maybe using a custom template tag
>
> On 29 abr, 21:52, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > uhhh
> > i tried but nooo... your suggestion doesn't work...
> > let me show you 2 versions of error...
>
> > 1. "Reverse for 'proyName.view_aboutPage' with arguments '()' and
> > keyword arguments '{}' not found."
> > settings:
> > # in proyName.packages.appName.urls.py:
> >  ... url(r'^about/$', 'view_aboutPage',
> > name='proyName.link_aboutPage'), ...
> > # in the template (about.html):
> > ... show 'about' ...
>
> > 2. "Reverse for '' with
> > arguments '()' and keyword arguments '{}' not found."
> > settings:
> > # in proyName.packages.appName.urls.py:
> >  ... url(r'^about/$', 'view_aboutPage', name='link_aboutPage'), ... #
> > also fails with "name='proyName.link_aboutPage'"
> > # in the template (about.html):
> > ... show
> > 'about' ...
>
> > by the way, the view loks like:
> > # in proyName.packages.appName.views.py:
> > ...
> > def view_aboutPage(request):
> >         return render_to_response('pages/about.html',
> > context_instance=RequestContext(request))
> > ...
>
> > what can i do?? honestly, i do not know...
> > thanks!
>
> > On Apr 29, 12:37 pm, Kevin Audleman <kevin.audle...@gmail.com> wrote:
>
> > > You might be able to solve your problem by changing the name attribute
> > > of your URL to include  "proyName":
>
> > > url(r'^about/$', 'view_aboutPage', name='proyName.view_aboutPage'),
>
> > > ---
>
> > > The error message is telling you exactly what it's looking for, after
> > > all:
>
> > > the error:
> > > "Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword
> > > arguments '{}' not found."
>
> > > I have solved most of my URL problems this way.
>
> > > Cheers,
> > > Kevin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: url template tag help

2009-04-30 Thread Julián C . Pérez

by now, i'll try to found some other way to create dynamic urls based
on the views...
maybe using a custom template tag

On 29 abr, 21:52, Julián C. Pérez <jcp...@gmail.com> wrote:
> uhhh
> i tried but nooo... your suggestion doesn't work...
> let me show you 2 versions of error...
>
> 1. "Reverse for 'proyName.view_aboutPage' with arguments '()' and
> keyword arguments '{}' not found."
> settings:
> # in proyName.packages.appName.urls.py:
>  ... url(r'^about/$', 'view_aboutPage',
> name='proyName.link_aboutPage'), ...
> # in the template (about.html):
> ... show 'about' ...
>
> 2. "Reverse for '' with
> arguments '()' and keyword arguments '{}' not found."
> settings:
> # in proyName.packages.appName.urls.py:
>  ... url(r'^about/$', 'view_aboutPage', name='link_aboutPage'), ... #
> also fails with "name='proyName.link_aboutPage'"
> # in the template (about.html):
> ... show
> 'about' ...
>
> by the way, the view loks like:
> # in proyName.packages.appName.views.py:
> ...
> def view_aboutPage(request):
>         return render_to_response('pages/about.html',
> context_instance=RequestContext(request))
> ...
>
> what can i do?? honestly, i do not know...
> thanks!
>
> On Apr 29, 12:37 pm, Kevin Audleman <kevin.audle...@gmail.com> wrote:
>
> > You might be able to solve your problem by changing the name attribute
> > of your URL to include  "proyName":
>
> > url(r'^about/$', 'view_aboutPage', name='proyName.view_aboutPage'),
>
> > ---
>
> > The error message is telling you exactly what it's looking for, after
> > all:
>
> > the error:
> > "Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword
> > arguments '{}' not found."
>
> > I have solved most of my URL problems this way.
>
> > Cheers,
> > Kevin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: url template tag help

2009-04-29 Thread Julián C . Pérez

uhhh
i tried but nooo... your suggestion doesn't work...
let me show you 2 versions of error...

1. "Reverse for 'proyName.view_aboutPage' with arguments '()' and
keyword arguments '{}' not found."
settings:
# in proyName.packages.appName.urls.py:
 ... url(r'^about/$', 'view_aboutPage',
name='proyName.link_aboutPage'), ...
# in the template (about.html):
... show 'about' ...

2. "Reverse for '' with
arguments '()' and keyword arguments '{}' not found."
settings:
# in proyName.packages.appName.urls.py:
 ... url(r'^about/$', 'view_aboutPage', name='link_aboutPage'), ... #
also fails with "name='proyName.link_aboutPage'"
# in the template (about.html):
... show
'about' ...

by the way, the view loks like:
# in proyName.packages.appName.views.py:
...
def view_aboutPage(request):
return render_to_response('pages/about.html',
context_instance=RequestContext(request))
...

what can i do?? honestly, i do not know...
thanks!


On Apr 29, 12:37 pm, Kevin Audleman  wrote:
> You might be able to solve your problem by changing the name attribute
> of your URL to include  "proyName":
>
> url(r'^about/$', 'view_aboutPage', name='proyName.view_aboutPage'),
>
> ---
>
> The error message is telling you exactly what it's looking for, after
> all:
>
> the error:
> "Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword
> arguments '{}' not found."
>
> I have solved most of my URL problems this way.
>
> Cheers,
> Kevin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez

OMG!
excellent, kevin... just what i wanted!
works smooth and nice
thanks a lot
;)

On Apr 29, 12:42 pm, Kevin Audleman <kevin.audle...@gmail.com> wrote:
> You're in luck, I just programmed this exact thing:
>
> Define the following function right above your model:
>
> def upload_location(instance, filename):
>         return 'profile_photos/%s/%s' % (instance.user.username,
> filename)
>
> My function uses 'profile_photos' as the base directory appended to
> MEDIA_ROOT; you might want to rename that. Then in your model, define
> your image field as so:
>
> photo_1 = models.ImageField(upload_to=upload_location, blank=True)
>
> Cheers,
> Kevin
>
> On Apr 29, 8:12 am, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > thanks...
> > but...
> > how can i make that attribute a callable tto work with user-specif
> > paths??
>
> > On 29 abr, 03:18, Kip Parker <k...@friendchip.com> wrote:
>
> > > upload_to can be a callable 
> > > -http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield.
>
> > > On Apr 29, 4:59 am, "Carlos A. Carnero Delgado"
>
> > > <carloscarn...@gmail.com> wrote:
> > > > Oops, too quick to press reply :o
>
> > > > On Tue, Apr 28, 2009 at 11:53 PM, Carlos A. Carnero Delgado >
> > > > destination_file = open('somewhere based on the user', 'wb+')
>
> > > > >  for chunk in request.FILES['audio_file'].chunks():
> > > > >      destination_file.write(chunk)
> > > > >  destination_file.close()
>
> > > > with this method you are manually handling the file, stepping over
> > > > Django's FileField. You should make adjustments & corrections to
> > > > account for that.
>
> > > > Also note that 'audio_file' is just the name of the field, it should
> > > > be named with your field name, of course. Remember also to include
> > > > request.FILES when creating your form object after a POST.
>
> > > > HTH,
> > > > Carlos.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: url template tag help

2009-04-29 Thread Julián C . Pérez

jajaja it's not top secret
what more information should i provide??

On 29 abr, 11:55, Malcolm Tredinnick <malc...@pointy-stick.com> wrote:
> On Wed, 2009-04-29 at 08:10 -0700, Julián C. Pérez wrote:
> > actually... i don't use underscores into my url or views names...
> > that 'view_aboutPage' was actually just a made up example name
>
> Sounds like you need to provide more accurate information then. Provide
> the actual data that is failing. If you can't use the real string from
> your program because it reveals Secret Project Name, then change it to
> something else, but check that the something else *still fails*. Reverse
> URL resolving is not broken, as a concept. Which means it's something
> specific about what you are doing, so the precise details are important.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez

thanks...
but...
how can i make that attribute a callable tto work with user-specif
paths??

On 29 abr, 03:18, Kip Parker  wrote:
> upload_to can be a callable 
> -http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield.
>
> On Apr 29, 4:59 am, "Carlos A. Carnero Delgado"
>
>  wrote:
> > Oops, too quick to press reply :o
>
> > On Tue, Apr 28, 2009 at 11:53 PM, Carlos A. Carnero Delgado >
> > destination_file = open('somewhere based on the user', 'wb+')
>
> > >  for chunk in request.FILES['audio_file'].chunks():
> > >      destination_file.write(chunk)
> > >  destination_file.close()
>
> > with this method you are manually handling the file, stepping over
> > Django's FileField. You should make adjustments & corrections to
> > account for that.
>
> > Also note that 'audio_file' is just the name of the field, it should
> > be named with your field name, of course. Remember also to include
> > request.FILES when creating your form object after a POST.
>
> > HTH,
> > Carlos.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: url template tag help

2009-04-29 Thread Julián C . Pérez

actually... i don't use underscores into my url or views names...
that 'view_aboutPage' was actually just a made up example name

On 29 abr, 05:17, Christian Berg <xeniac...@gmail.com> wrote:
> it also helps to rename the URL to view-about-page. Dashed do work.
> It seems that URL Namen are bound to slug resitrictions.
>
> On 29 Apr., 03:06, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > hi everyone
> > i need some help over here... please!
> > i don't know what it's wrong...
>
> > the url i'm trying to get around is:http://proyName/about/
>
> > the error:
> > "Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword
> > arguments '{}' not found."
>
> > in a template, the dispatcher of the error:
> > # template.html
> > ...
> > a link to the 'about' page
> > ...
>
> > i have a general urls.py file who looks like:
> > # proyName/urls.py
> > ...
> > url(r'^/', include('proyName.package.appName.urls')),
> > ...
> > where appName includes the 'view_aboutPage' view in its views.py
> > 'package' it's just a folder to wrap up all the available apps
>
> > and also i have a urls.py file in appName, and it is:
> > # proyName/package/appName/urls.py
> > ...
> > url(r'^about/$', 'view_aboutPage', name='view_aboutPage'),
> > ...
>
> > please... help!
> > what is it wrong in there??
> > thank u all
> > bye!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez

ok, you're right... sorry for the rush
i can wait
;)

On Apr 28, 8:12 pm, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> 2009/4/29 Julián C. Pérez <jcp...@gmail.com>:
>
>
>
> > anyone??
> > how can i make that happen??
>
> You asked your original question 4 hours ago. This is an international
> mailing list. Many of the audience for your message are asleep. Please
> show some patience.
>
> If you have a more immediate need please try a more immediate forum -
> such as the #django IRC channel.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez

anyone??
how can i make that happen??

On Apr 28, 3:41 pm, Julián C. Pérez <jcp...@gmail.com> wrote:
> hi u all
> i'm progressing in my django wisdom jeje
> but everyday i face new challenges and/or problems...
> 'im working on a uploading files application...
> and i want to store every uploaded file into its right path, arranged
> by username
>
> example...
> if a user called 'user123' uploads a file from a regular filefield in
> a form... lets say: text.pdf
> i want that pdf to be stored into 'path/to/uploads/user123/text.pdf'
> right now i have 'path/to/uploads/text.pdf'
>
> the model around the files is something like:
> class Upload (models.Model):
>   userUploader = models.ForeignKey(User)
>   date = models.DateTimeField(default=datetime.datetime.now)
>   fileUpload = models.FileField(upload_to=PATH)
>
> how can i link the current user logged in to its specific path??
> i mean, how can i make something like:
> fileUpload = models.FileField(upload_to=PATH + "/" + User.username)
> ??
>
> i hope i got myself clear...
> bye!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



url template tag help

2009-04-28 Thread Julián C . Pérez

hi everyone
i need some help over here... please!
i don't know what it's wrong...

the url i'm trying to get around is:
http://proyName/about/

the error:
"Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword
arguments '{}' not found."

in a template, the dispatcher of the error:
# template.html
...
a link to the 'about' page
...

i have a general urls.py file who looks like:
# proyName/urls.py
...
url(r'^/', include('proyName.package.appName.urls')),
...
where appName includes the 'view_aboutPage' view in its views.py
'package' it's just a folder to wrap up all the available apps

and also i have a urls.py file in appName, and it is:
# proyName/package/appName/urls.py
...
url(r'^about/$', 'view_aboutPage', name='view_aboutPage'),
...

please... help!
what is it wrong in there??
thank u all
bye!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez

hi u all
i'm progressing in my django wisdom jeje
but everyday i face new challenges and/or problems...
'im working on a uploading files application...
and i want to store every uploaded file into its right path, arranged
by username

example...
if a user called 'user123' uploads a file from a regular filefield in
a form... lets say: text.pdf
i want that pdf to be stored into 'path/to/uploads/user123/text.pdf'
right now i have 'path/to/uploads/text.pdf'

the model around the files is something like:
class Upload (models.Model):
  userUploader = models.ForeignKey(User)
  date = models.DateTimeField(default=datetime.datetime.now)
  fileUpload = models.FileField(upload_to=PATH)

how can i link the current user logged in to its specific path??
i mean, how can i make something like:
fileUpload = models.FileField(upload_to=PATH + "/" + User.username)
??

i hope i got myself clear...
bye!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



More than one DB configuration in settings.py

2009-03-17 Thread Julián C . Pérez

Hi everyone
I need some help here
I'm in a rush, so I don't took first the time to explore the board and
solve this doubt...
How can I make two different DB configurations on the settings.py??
I mean... I manage my project through svn, but i make changes all over
it on two enviroments... Yes, you can figure it out: one Linux-based
and a Windows-based. So the DB host and name are not the same...
How can I do that??
- I imagine something like... DATABASE_HOST = { '127.0.0.1',
'172.3.25.200' } > the Windows host, then the Linux host
Thank you 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
-~--~~~~--~~--~--~---



A distributed DB

2009-03-17 Thread Julián C . Pérez

Hi again
Another questions circling my head...
Anyone know any distributed DB system to engaged with Django/python??
I'm developing an storage application (uploading files into an
account) and it'd be useful
What about something like Cassandra, or Project Voldemort?? -
opensource alternatives to Amazon's Dynamo
Suggestions??
Once again, 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: a little help on creating a 'global' file

2009-03-10 Thread Julián C . Pérez

ok
thank u all
i solved my problem using a request context
;)

On 9 mar, 14:40, Briel <toppe...@gmail.com> wrote:
> The problem you are seeing regarding the link i mentioned briefly in
> my last post. Django does auto escapingbe default of all template vars
> and values. In your case that means that you see the html you wrote
> because the <>" has been converted to a code that will display the
> signs but disable the code. You can either use the |safe tag or stop
> the auto escaping entirely for a part or the whole template. But you
> need to be careful if you have user inputs on your site.
>
> If you plan on using yourglobalfunctions in the template only you
> should considder creating your own template tags. That would also
> solve any import problems.
>
> You can read about both things in the django docs, can't give you the
> links right now as I'm on mobile but search for template tags or auto
> escape and you should hit some relevant stuff.
>
> ~Briel
>
> On 9 Mar., 19:12, Julián C. Pérez <jcp...@gmail.com> wrote:
>
> > ok briel, maybe i should explain myself better
> > you're right about the function with that innecesary 'request'
> > object... but i'd need it for any other function -yet to be
> > implemented
> > -by the way, i use the shortcut render_to_response
>
> > regarding the html stuff, with the function defined early if i make
> > the call as:
> > - in a html template...
> > 
> > ...
> > {{ ocultarEstado }}
> > ..
> > 
> > i get: 
> > (aceptar)
> > instead of a link: (aceptar)
>
> > regarding the part of importing the functions...
> > what i want is to import all the functions within that
> > 'globalValues.py'
> > actually i have only the import for the ocultarEstado method, done in
> > the settings.py file with:
> > ...
> > TEMPLATE_CONTEXT_PROCESSORS = ( ...
> > 'myproject.globalValues.ocultarEstado', ... )
> > ...
> > i mean, i don't want to import each new method like:
> > ...
> > TEMPLATE_CONTEXT_PROCESSORS = ( ...
> > 'myproject.globalValues.function1',
> > 'myproject.globalValues.function2',
> > 'myproject.globalValues.function3', ... )
> > ...
> > but something like: 'myproject.globalValues.*'
>
> > On 9 mar, 11:35, Briel <toppe...@gmail.com> wrote:
>
> > > 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 theglobal
> > > namespace, so you could call it by typing ocultarEstado(...). Another
> > > way to import would be to do,
> > > from myproject import globalValues asglobal
> > > 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

Re: a little help on creating a 'global' file

2009-03-09 Thread Julián C . Pérez

ok briel, maybe i should explain myself better
you're right about the function with that innecesary 'request'
object... but i'd need it for any other function -yet to be
implemented
-by the way, i use the shortcut render_to_response

regarding the html stuff, with the function defined early if i make
the call as:
- in a html template...

...
{{ ocultarEstado }}
..

i get: 
(aceptar)
instead of a link: (aceptar)

regarding the part of importing the functions...
what i want is to import all the functions within that
'globalValues.py'
actually i have only the import for the ocultarEstado method, done in
the settings.py file with:
...
TEMPLATE_CONTEXT_PROCESSORS = ( ...
'myproject.globalValues.ocultarEstado', ... )
...
i mean, i don't want to import each new method like:
...
TEMPLATE_CONTEXT_PROCESSORS = ( ...
'myproject.globalValues.function1',
'myproject.globalValues.function2',
'myproject.globalValues.function3', ... )
...
but something like: 'myproject.globalValues.*'



On 9 mar, 11:35, Briel <toppe...@gmail.com> wrote:
> 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' : 'hi u user!' }
> > # 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
-~--~~~~--~~--~--~---



Re: a little help on creating a 'global' file

2009-03-09 Thread Julián C . Pérez

ok alex -and thank for your so quick assistance
let's see if i get it -i guess not, because have an syntax error

having this in settings.py file:
# --
...
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'miproject.valoresGlobales',
)
...
# --

you mean something like... -the code below is located at /
path.to.myproject/valoresGlobales.py
# --
import *
def ocultarEstado(request):
valor = """


(aceptar)
"""
return { 'ocultarEstado' : valor }
# --
... that??

another thing...
don't you know how to output that dictionary entry with html format??

On 9 mar, 11:16, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Mon, Mar 9, 2009 at 11:11 AM, 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' : 'hi u user!' }
> > # 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 can do from myproject.globalValues import * which will add everything in
> that namespace to your current one, however, in general, this is very
> discouraged within Python, but you can do it if you like.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



a little help on creating a 'global' file

2009-03-09 Thread Julián C . Pérez

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' : 'hi u user!' }
# 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
-~--~~~~--~~--~--~---



Re: serving multiple hosts from a single django instance ?

2006-12-22 Thread julián


One more alternative:
you can capture the hostname with mod_rewrite and pass it to your views
using mod_proxy:

RewriteCond %{HTTP_HOST} ^site-one\.example\.com  [NC]
RewriteRule ^/(.*)$  /hostname/aware/view/%1/$1  [L,QSA,P]

(I've wrote from memory, it's not tested)

Then it's your view code responsability to filter content using the
hostname received that you should capture with your url configuration.

This is useful if you need to ellaborate on the mod_rewrite part before
reaching your python code.

j.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Yet another installation question (on Godaddy)

2006-10-10 Thread julián

> I know I need flup. And I need to put the Django source on the server.
> But *where* do I upload them to, and *how* do I install them (how do i
> run the setup.py) without SSH?
>
> Any help would be awesome.
>
I don't know about godaddy deluxe but it seems you should do everything
using CGIs.

Copy the django source somewhere in your home. Write a CGI to run the
setup.py, like

#!/bin/sh
echo Content-type: text/html
echo
cd /path/to/django/source
/path/to/python setup.py install --prefix=/path/to/your/home/python
2>&1

The same to sync the db, etc...

Hope this helps (a little)
(in case you didn't pay 12 months in advance you have some
alternatives: http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django hosting

2006-07-14 Thread julián

Send me a private (to avoid being off-topic) e-mail with the type of
project (mainly how many users will test it, if you required disk for
file uploads and this kind of things)

If the client buy I cant host the final version for a bargain price ;)

--
Julián Romero


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



manytomany polimorphic

2006-06-29 Thread julián

I have a model similar to:

class ProductOne(models.Model):
   name = ...
   price = ...
   ...

class ProductTwo(models.Model):
   name = ...
   category = ...

Whatever two different models.

I want to log activity on this many models with a class like

class LogEntry(models.Model):
   timestamp = Date...
   action = choice...
   product = ManyToMany(ProductOne OR ProductTwo)

How can I have a product field in LogEntry that can points to a
ProductOne object or to a ProductTwo?

thanks,   
J.R.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How to write a module level method rather than a instance method

2006-05-22 Thread julián

Did you tried Google?

http://www.google.com/search?hl=en==model+method+starts+with+%22_module_%22=Search

http://www.djangoproject.com/documentation/models/custom_methods/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: instant django

2006-05-07 Thread julián

ross.lazarusatgmail.com wrote:
> related to my work, but I'm interested to see if there are people
> willing to work on it as a django utility. All suggestions welcomed.
>
Quite interesting for me.
Solicited suggestion (or random thougth) follows.

I have something similar in my some-day-perhaps projects queue. I
thought rather to use a 2 steps approach.
First step is a django application that generates django applications
(it's better than a script to allow anybody to install and test it, and
you have a GUI for free).
Second step is part of the generated application: run a shell script
that create the environment, sync the database, load test data...

It will work like this:

 * The app will allow to upload one or more text files (CSV mainly)
 * File names inspire model names. Field names came from fist line
header.
 * Within a simple wizard UI you can choose the relationship between
models (just a bunch of select boxes with model and field names, KISS
philosophy)
 * Choose app name, and press "generate"
 * You get a tar.gz with python code, ready to un-gzip-tar anywhere,
run a shell script that setup the environment, create database, syncdb
and load test data
 * Test data will be loaded with python code like
MyClassOne(field1="aaa", field2="bbb",
field3=MyClassTwo(field1="ccc")).save()
 * The generated app run like any other, python manage.py runserver...

The app will store uploaded files with some other information (custom
templates, media files...) just to allow later modifications and app
regeneration.

I've take a glance at your script, it seems your approach is more
auto-contained but the target is the same, i.e. to generate easy apps
fast, isn'it?

Difficult to explain in a foreign language. Next time I'll try to
express myself in python.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django server

2006-05-07 Thread julián

Next time, under linux, you can use fuser:

# fuser -n tcp 8000
8000/tcp: 1234 567

where 1234 and 567 are the pid of the processes


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-05 Thread julián

A web-based model editor is not an easy task. I think vi is the right
modeller tool (after a paper/pencil session)  or emacs if you're a
pianist.

For GUI-tools-aficionados I'd rather devote the effort to write code
generators for apps like umbrello
[http://uml.sourceforge.net/index.php]. A lot easier. A lot more
useful. 

j.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---