Re: Dojango question

2008-11-02 Thread Wolfram Kriesing
awesome :-) Glad I could help. Feel free to ask anything, I will try to help! -- cu Wolfram http://uxebu.com - web consultancy You need AJAX, RIA, JavaScript and all this modern stuff? We got it! On Sun, Nov 2, 2008 at 1:14 AM, Rob Goedman <[EMAIL PROTECTED]> wrote: > > Wolfram, > > You bet

previewing a form - best way?

2008-11-02 Thread Flavio
Hi there. Following scenario: I have a model that contains several options about the layout of a page, for example background-image and background-color, some text fields etc. the model also has a unique slug field, which indicates where the page is located. Now I want to write a form that allo

Re: sharing a module level variable

2008-11-02 Thread Steve Holden
belred wrote: > i have an wget event in a cron job. the view does some processing > which involves calling external websites and databases (takes about 25 > seconds) and updates some module level dictionary lookup variables > (about 7 MB of data) which the rest of the program reads. but > unfort

Re: django signals

2008-11-02 Thread Steve Holden
belred wrote: > i'm having touble finding documention about django signals that > explain how they behave under apache child processes. if i have a > signal go off and have a listener for that signal. will only the > listener in same child process receive it or will that same listener > in all apa

Re: How to get comment_count in view?

2008-11-02 Thread Chatchai Neanudorn
from django.contrib.comments.models import Comment from post.models import Post #get comments for model Comment.objects.for_model(Post).count() #get comment for instance Comment.objects.for_model(Post.objects.get(id=1)).count() 2008/11/2 David.D <[EMAIL PROTECTED]> > > I can get comment_count i

Re: Model inheritance question

2008-11-02 Thread Ramiro Morales
On Sun, Nov 2, 2008 at 4:52 AM, void <[EMAIL PROTECTED]> wrote: > > Can someone point to the correct way to do this? > > Suppose i'm working in a tumblelog, it's basically , 4 o 5 tipes of > "post item" that share some cmmon information. > > So the first approach i would go is: > > cllass Post(mod

Re: sharing a module level variable

2008-11-02 Thread belred
On Nov 2, 3:29 am, Steve Holden <[EMAIL PROTECTED]> wrote: > belred wrote: > > i have an wget event in a cron job.  the view does some processing > > which involves calling external websites and databases (takes about 25 > > seconds) and updates some module level dictionary lookup variables > >

Django doesnt allow addition of time when using custom sql query

2008-11-02 Thread reyjexter
I'm getting this error: Caught an exception while rendering: hour must be in 0..23 What I'm doing is adding up all the time that was recorded (time field) and I noticed that when ever the total is greater than 23:00:00 this error comes up. I tried executing the same query using a mysql query br

Re: Cascading List List Boxes

2008-11-02 Thread Steve Bergman
You will need to display the dependent ChoiceField empty at first, but set the first ChoiceField to submit the form "onchange". (I like to use the JQuery events system for this, but you can do it with "attr".) Then have the view redisplay the form with the dependent ChoiceField populated. IIRC, t

Re: Django doesnt allow addition of time when using custom sql query

2008-11-02 Thread reyjexter
dont mind me ppl. i got this working. i simply used a mysql function that returns a string for example TRIM() On Nov 2, 8:26 am, reyjexter <[EMAIL PROTECTED]> wrote: > I'm getting this error: > > Caught an exception while rendering: hour must be in 0..23 > > What I'm doing is adding up all the ti

Password Field Form

2008-11-02 Thread nkulmati
How come this page: http://docs.djangoproject.com/en/dev/ref/forms/fields/#module-django.forms.fields does not contain information about password fields? How do I create and use a password form field then? Clearly, django has support for password form fields, since they are used in the standard

Re: Keeping track of online users

2008-11-02 Thread Jeff FW
Can you be more specific? What are you trying to do? -Jeff On Nov 1, 3:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have found some post of 2007 on this argument but maybe with django > 1.0 something is changed. > > how do you do that ? > > thanks everyone :) --~--~-~--~---

Re: Password Field Form

2008-11-02 Thread [EMAIL PROTECTED]
Hi Nick, you can do this by passing the widget parameter to a CharField. A little example: password = forms.CharField(label=_(u'Password'),widget=forms.PasswordInput(render_value=False)) Lukas On Nov 2, 5:58 pm, nkulmati <[EMAIL PROTECTED]> wrote: > How come this > page:http://docs.djangoproje

random queryset how to

2008-11-02 Thread AvK
hi, i want to get random records form the database, the queryset looks like this : " questions = Question.objects.filter(quiz__pk=quiz_id).order_by('?') [:10] " the problem is that if i want to use questions variable again, it everytimes changes the returned records from db for a new random an

random queryset, how to

2008-11-02 Thread AvK
hi, i want to get random records form the database, the queryset looks like this : " questions = Question.objects.filter(quiz__pk=quiz_id).order_by('?') [:10] " the problem is that if i want to use questions variable again, it everytimes changes the returned records from db for a new random and

Strange admin validation behaviour.

2008-11-02 Thread jiussa
Hi Been working through the online tutorial without problems up to the end of part 3. However if I now go back to the admin and try to edit choices for a Poll I get an error message saying "Please correct the errors below." without indicating any particular field. If I have created no Choices fo

random queryset

2008-11-02 Thread AvK
hi, i want to get random records form the database, the queryset looks like this : " questions = Question.objects.filter(quiz__pk=quiz_id).order_by('?') [:10] " the problem is that if i want to use questions variable again, it everytimes changes the returned records from db for a new random an

Advice needed on admin-template replacement

2008-11-02 Thread Matt Brown
I'm wondering if I did the right thing, here. I wanted to replace the admin/base_site.html template, but only for requests to /myapp/admin/ *, leaving requests to /admin/* alone. The first thing I tried was a copy/modify of base_site.html to myapp/ templates/admin/myapp/, but the modifications w

Re: Password Field Form

2008-11-02 Thread Lukas Klein
Hi Nick, you can do this by passing the widget parameter to a CharField. A little example: password = forms .CharField (label=_(u'Password'),widget=forms.PasswordInput(render_value=False)) Lukas Am 02.11.2008 um 17:58 schrieb nkulmati: > > How come this page: > http://docs.djangoproject.co

Re: previewing a form - best way?

2008-11-02 Thread TiNo
http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/ ?? On Sun, Nov 2, 2008 at 6:54 AM, Flavio <[EMAIL PROTECTED]> wrote: > > Hi there. > > Following scenario: > > I have a model that contains several options about the layout of a > page, for example background-image and backg

__str__, __unicode__ representation of model fields

2008-11-02 Thread Bülent Aldemir
Hi, given class MyModel(models.Model): name = models.CharField(max_length=150) myinteger = models.IntegerField() ^ def __unicode__(self): return u"Here is my: %s" % (self.name) one has to give a __unicode__ method to get a nice string representation of MyModel() I need

Re: random queryset, how to

2008-11-02 Thread Steve Holden
AvK wrote: > hi, > i want to get random records form the database, the queryset looks > like this : > " > questions = Question.objects.filter(quiz__pk=quiz_id).order_by('?') > [:10] > > " > the problem is that if i want to use questions variable again, it > everytimes changes the returned record

Re: random queryset, how to

2008-11-02 Thread Steve Holden
AvK wrote: > hi, > i want to get random records form the database, the queryset looks > like this : > " > PS: You asked this question at 11:44, then again at 11:45 and yet again at 12:25. Please have a little patience! regards Steve --~--~-~--~~~---~--~~ You

Re: Advice needed on admin-template replacement

2008-11-02 Thread Matt Brown
Looks like I posted too soon. Apparently my third solution above *only* works on the index page. Clicking on a model page from there reverts the view back to the default template. So I am looking for any solution to this problem that doesn't involve modifying every admin-site template. Thanks,

touching wsgi file

2008-11-02 Thread belred
is touchingt the wsgi file supposed reload every file in the the entire django project or just just reload the one wsgi file? thanks, bryan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: touching wsgi file

2008-11-02 Thread Graham Dumpleton
On Nov 3, 7:09 am, belred <[EMAIL PROTECTED]> wrote: > is touchingt the wsgi file supposed reload every file in the the > entire django project or just just reload the one wsgi file? If you are talking about the WSGI script file when using Apache/ mod_wsgi, it depends on how you have Apache/mod

Re: touching wsgi file

2008-11-02 Thread belred
i am using linux and i am using mod_wsgi to run django. i don't understand this sentence. "This should only be done for daemon processes and not within the Apache child processes"... we have many apache child process. if i follow this code: if environ['mod_wsgi.process_group'] != '': impo

Re: sharing a module level variable

2008-11-02 Thread Graham Dumpleton
On Nov 3, 2:03 am, belred <[EMAIL PROTECTED]> wrote: > On Nov 2, 3:29 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > belred wrote: > > > i have an wget event in a cron job.  the view does some processing > > > which involves calling external websites and databases (takes about 25 > > > se

Re: __str__, __unicode__ representation of model fields

2008-11-02 Thread JoeJ
To get an integer to print with leading 0s print '%0d' % my_model.myinteger To get an integer to print with 10 digits, filled with leading 0s print '%0.10d' % my_model.myinteger If you wanted this to be the default value shown for the model def __unicode__(self): return u'%0.10d' % self.myinteg

Re: Keeping track of online users

2008-11-02 Thread JoeJ
Are you looking for something like 'django-tracking' ?? http://code.google.com/p/django-tracking/ I was just perusing this last night, for use on a site of mine. -- joe On Nov 1, 3:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have found some post of 2007 on this argument but ma

Re: webfaction django installation

2008-11-02 Thread JoeJ
>From personal experience ... The webfaction support crew is AWESOME and either interact with you at a clue-level, if you have one ... or they will reach out and fix stuff in your files, if you have somewhat less than a clue. Their forums, FAQ and how-to docs are well populated. And ... those a

Re: webfaction django installation

2008-11-02 Thread Tom Badran
Yes, I would second that. They have been great both when i know exactly what i need them to do, and equally as good when I've been completely useless and not had a clue about something. Tom On Sun, Nov 2, 2008 at 11:11 PM, JoeJ <[EMAIL PROTECTED]> wrote: > > > From personal experience ... > > Th

Re: touching wsgi file

2008-11-02 Thread Graham Dumpleton
On Nov 3, 9:55 am, belred <[EMAIL PROTECTED]> wrote: > i am using linux and i am using mod_wsgi to run django. > > i don't understand this sentence. > > "This should only be done for daemon processes and not within the > Apache child processes"... > > we have many apache child process.  if i fol

Re: Query subset

2008-11-02 Thread Tonne
In this case, as the amount of data is fairly small, I'm inclined to download the full queryset and let the template ignore the irrelevant data. Thanks Russ & Marcelo for your very helpful insights. --~--~-~--~~~---~--~~ You received this message because you are s

Re: sharing a module level variable

2008-11-02 Thread belred
On Nov 2, 2:58 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Nov 3, 2:03 am, belred <[EMAIL PROTECTED]> wrote: > > > > > On Nov 2, 3:29 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > belred wrote: > > > > i have an wget event in a cron job.  the view does some processing > > > > whic

Re: Model inheritance question

2008-11-02 Thread felix
see also this: http://www.djangosnippets.org/snippets/1031/ for a tumblelog I have been actually fetching queries for each item type, concatenating them as lists, then sorting by date. that's much simpler since its usually mostly display. I mostly use model inheritance in situations where I need

Re: touching wsgi file

2008-11-02 Thread belred
thanks for your detailed explanation. i had to read it 3 times to try to absorb everything :) i do not need to have the code be portable beyond mod_wsgi. if i'm following what you and steve have said and pages you both pointed me to, it appears if i want to share global data i really need to use

Django's decoupling apps but template should couple them together, right?

2008-11-02 Thread ilmarik
It's just simple amazing that I waste another night to figure out how to glue two and more apps together inside one template. I read about custom tags and I thing it isn't (or at least it shouldn't be) the way of doing it. too much fuss imho. Example: I have home page with menu on one side, news

Re: Django's decoupling apps but template should couple them together, right?

2008-11-02 Thread Dj Gilcrease
Once you get each working individually, I would make inclusion tags for the items that will be on every page (Menu, NewsList, Footer, Survey). The contents in the middle is what is shown by a view (At least in my setup) Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com --~--~-~--~-

Re: Django's decoupling apps but template should couple them together, right?

2008-11-02 Thread ilmarik
are you saing this: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags is an explanation to my question ? If yes, many thanks to you and... silly me. if not, could you point me some solution explained in detail? --~--~-~--~~~---~--~~

Re: Django's decoupling apps but template should couple them together, right?

2008-11-02 Thread Steve Holden
ilmarik wrote: > It's just simple amazing that I waste another night to figure out how > to glue two and more apps together inside one template. > I read about custom tags and I thing it isn't (or at least it > shouldn't be) the way of doing it. too much fuss imho. > > Example: > I have home page

Re: Django's decoupling apps but template should couple them together, right?

2008-11-02 Thread Dj Gilcrease
Yes exactly. http://dpaste.com/hold/88396/ is the inclusion tag that I use for my navigation menu @ http://www.gustafsonandassociates.com/ Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com On Sun, Nov 2, 2008 at 6:57 PM, ilmarik <[EMAIL PROTECTED]> wrote: > > are you saing this: > http

Re: touching wsgi file

2008-11-02 Thread Graham Dumpleton
On Nov 3, 12:31 pm, belred <[EMAIL PROTECTED]> wrote: > thanks for your detailed explanation.  i had to read it 3 times to try > to absorb everything :) i do not need to have the code be portable > beyond mod_wsgi.  if i'm following what you and steve have said and > pages you both pointed me to

Re: sharing a module level variable

2008-11-02 Thread Graham Dumpleton
On Nov 3, 11:53 am, belred <[EMAIL PROTECTED]> wrote: > On Nov 2, 2:58 pm, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > > > On Nov 3, 2:03 am, belred <[EMAIL PROTECTED]> wrote: > > > > On Nov 2, 3:29 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > belred wrote: > > > > > i have an w

Re: Admin won't display datetime widget with custom form?

2008-11-02 Thread Mara Rinn
On Oct 30, 4:04 pm, lapucho <[EMAIL PROTECTED]> wrote: > Can I use AdminDateWidget outside admin app? > > from django.contrib.admin import widgets > from models import AvisoPublicitario > from django.forms import ModelForm > > class AvisoPublicitarioForm(ModelForm): > >     fecha = forms.DateField

[OT] Python package names

2008-11-02 Thread stryderjzw
HI, This is semi-off topic, but it is a python question. I'm trying to use some of the generic django applications, like django- tagging. Taking django-tagging, for example, it requires me to symlink the source folder to "site-packages/tagging". However, I want to keep site-packages structured a

Re: Python package names

2008-11-02 Thread Daniel Roseman
On Nov 3, 4:58 am, stryderjzw <[EMAIL PROTECTED]> wrote: > HI, > > This is semi-off topic, but it is a python question. > > I'm trying to use some of the generic django applications, like django- > tagging. Taking django-tagging, for example, it requires me to symlink > the source folder to "site-

Re: Python package names

2008-11-02 Thread stryderjzw
Hmm, I tried django_tagging, but it still gives me ImportErrors. I think it's because, for django-tagging project, they internally look for tagging as the package name. On Nov 2, 11:44 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Nov 3, 4:58 am, stryderjzw <[EMAIL PROTECTED]> wrote: > >