Model inheritance question

2008-11-01 Thread void
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(models.Model): here goes common metada of all things that can be "posted" like

How to get comment_count in view?

2008-11-01 Thread David.D
I can get comment_count in templates: {% get_comment_count for object as comment_count %} But how to get it in my view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: webfaction django installation

2008-11-01 Thread Benn
This article really helped. For all those django and webfaction newbies out there: this article is a must read. Worked perfect! Ben On Sep 21, 1:26 am, tupixo <[EMAIL PROTECTED]> wrote: > > I had also similar problems, because instead of documentation they have a > > screencast(?!) and the forum

sharing a module level variable

2008-11-01 Thread belred
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 unfortunately, only the one ap

django signals

2008-11-01 Thread belred
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 apache child processes rece

Re: Dojango question

2008-11-01 Thread Rob Goedman
Wolfram, You bet I've read your blogs! Wouldn't have gotten where I got to without them! Clearly I had missed the to_dojo_data(), that's exactly what I was looking for. This works super. Thanks a lot, Rob On Nov 1, 2008, at 4:45 PM, Wolfram Kriesing wrote: > > Hi Rob, > > aehm, maybe wha

Re: Dojango question

2008-11-01 Thread Wolfram Kriesing
Hi Rob, aehm, maybe what you were looking for was this: @json_response def send_toxids_list(request): ret = Toxid.objects.all() return to_dojo_data(ret, identifier='docno') the json_response decorator takes care of extrcting only the fields form the model, you dont have to do this by ha

Re: Dojango question

2008-11-01 Thread Wolfram Kriesing
Hi Rob, did you see the blog article http://blog.uxebu.com/2008/07/26/ajax-with-dojango/ and the examples in http://code.google.com/p/dojango/source/browse/trunk/dojango/views.py tbh I don't really understand what you are using the JSON serializer for. Could you may be explain, if the links abov

Template inheritance

2008-11-01 Thread fremder
Hello, I feel I have learned a lot about Django, and am loving it, but I seem to be missing something quite fundamental about template inheritance. Should templates be a set up only for "straight line" inheritance? My thinking about them leads to a "tree" where a template renders a "chunk" of a

access request.user in class Meta

2008-11-01 Thread Merrick
I am trying to dynamically generate a form, the fields will vary if the user is logged in. Here is where I am so far forms.py == class LinkForm(ModelForm): def __init__(self, *args, **kw): self.request = kw.pop('request') super(LinkForm, self).__init__(*args, **kw) c

Re: Deploying multiple django applications in a single apache server

2008-11-01 Thread Graham Dumpleton
Just be aware that by default mod_python assigns sub interpreters per name based virtual host and doesn't take into consideration the listener port. Therefore, if having two listener ports on the same host name, the same sub interpreter will be used for both, which means that Django instances will

Dojango question

2008-11-01 Thread Rob Goedman
Hi, Just for Django & Dojo users. Working through the 'Mastering Dojo' book, updating the examples where applicable to Dojo 1.2 (i.e. grids) and making them work with Django svn has gone pretty smoothly. I wonder if below method is a reasonable way to generate fairly generic xhr* responses

Re: Overriding admin templates

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote: > > Low Kian Seong wrote: > > http://www.djangobook.com/en/1.0/chapter17/ > > Yes, thank you, that's it. > > It worked nicely for the change_form.html example given in that > chapter. However, for the change_list.html it stil

Re: Dev & Production difference: escaping html in admin

2008-11-01 Thread Ramiro Morales
On Sat, Nov 1, 2008 at 4:21 PM, Alexey Moskvin <[EMAIL PROTECTED]> wrote: > > Hi, I have developer (win) & production (debian) installations of > Django 0.97. There is not such thing as a 0.97 release, are you sure you are using the same SVN revisions in both environments? > [...] > But on my p

Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm
Low Kian Seong wrote: > http://www.djangobook.com/en/1.0/chapter17/ Yes, thank you, that's it. It worked nicely for the change_form.html example given in that chapter. However, for the change_list.html it still doesn't work. Seems to me I've hit a django bug. Anyone else? /L > On Sat, Nov 1, 20

Keeping track of online users

2008-11-01 Thread [EMAIL PROTECTED]
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 :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Django Model key limits

2008-11-01 Thread Jorge Bastida
Hello !I'm working in a project using django an postgresql and probably i will manage a big model table. I have a few questions about the limits of the primary key in django model. By default the pk was defined in postgresql as a SERIAL NOT NULL with the integer data type. I search for the limits

Dev & Production difference: escaping html in admin

2008-11-01 Thread Alexey Moskvin
Hi, I have developer (win) & production (debian) installations of Django 0.97. There is one difference in admin app. I have a photogallery, and Picture model has this method: def show_thumb(self) : return '%s' % (self.get_image_url(), self.get_image_thumb_url(), self.image) also

Formset in template with extra per form

2008-11-01 Thread Steve Bergman
I have a formset, each form representing a row in a table. I also have a list of dictionaries, each list item providing additional data to print on that row. The formset and list of dictionaries are of arbitrary lengths, and potentially in the hundreds or even low thousands, so efficiency counts.

Re: HttpRequest with chunked encoding is not buffered

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 11:37 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > I actually am seeing some input, but it is divided into several, well, > chunks. I guess it's the same problem as seeing no input - I'd say > you're right and chunked encoding is silently unsupported (it would be >

Re: Why is my string not auto escaped?

2008-11-01 Thread Karen Tracey
On Wed, Oct 29, 2008 at 8:35 AM, shabda <[EMAIL PROTECTED]> wrote: > > I need to create a custom filter which displays some data from db > depending on its data type. > > My code is something like, > > from django.template.defaultfilters import linebreaks, urlize > > def filterxx(data) > retur

Re: HttpRequest with chunked encoding is not buffered

2008-11-01 Thread [EMAIL PROTECTED]
I actually am seeing some input, but it is divided into several, well, chunks. I guess it's the same problem as seeing no input - I'd say you're right and chunked encoding is silently unsupported (it would be nice if Django said something though). However, could you please suggest any workaround?

Cascading List List Boxes

2008-11-01 Thread Caisys
Hi, Is it possible to populate a list depending on another list choice? I am working on an event guide, when creating the event the user will need to select a place from a drop down list, some places have different rooms, so I want another drop down list containing the rooms that relate to the pl

Re: Splitting models.py won't install models

2008-11-01 Thread Alistair Marshall
Right I managed to fix it and feel really stupid at the same time but I thought I would post here in case anyone else has the same issue my mistake was using class meta: and not class Meta: doh! got to love case sensitivity. Thanks to all that offered suggestions Alistair --- Alistair Marshal

Re: Accessing Model field from ModelForm?

2008-11-01 Thread killsto
Thanks, that's a big help. On Nov 1, 5:14 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Nov 1, 5:33 am, killsto <[EMAIL PROTECTED]> wrote: > > > > > I have a basic form that shows what a person entered when it is > > submitted.  However, it shows up as a form.CharField (textbox) instead > >

Re: Why is my string not auto escaped?

2008-11-01 Thread varikin
On Oct 31, 8:28 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > > > So if these built in filters are marking my strings safe, inspite of > > > > unsafe data being passed in, should they not handle escaping as well? > > > > The problem seems to be that your filter function doesn't mark itself >

Re: can't delete many-to-many related record from admin inline

2008-11-01 Thread ndarkduck
I'm no guru, Im stuck also with some many-to-many features. 1.- why whould you need a 3rd table if you are not using attributes in the relationship? (Variant). 2.- have you tried to add an models.AutoField(primary=True) to your model Variant ? I knew django does that if no is specified in ord

Re: Deploying multiple django applications in a single apache server

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 9:03 AM, bluefireredsky <[EMAIL PROTECTED]>wrote: > > Hello, > > I have followed the link from django documentation on deploying an > application to apache2. > > http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ > > I have two applications, which I would like

Re: populating forms using models

2008-11-01 Thread Jorge Bastida
To populate select field you have many options. First is using ModelChoiceField. The ModelChoiceField have an argument named queryset, you can use like this example provincia = forms.ModelChoiceField(queryset=Provincia.objects.all() ..) If you can't have a FK of Provincia table you can use a C

Re: updating a single field / attribute, is it possible? or better practices?

2008-11-01 Thread Rock
In the meantime, creating and executing your own update command is not difficult. Here is a snippet for a custom PositionField that updates itself when necessary with an SQL UPDATE: http://www.djangosnippets.org/snippets/884/ --~--~-~--~~~---~--~~ You received th

Re: populating forms using models

2008-11-01 Thread Rock
In brief, your forms field for province does not have to have anything to do with your corresponding model field. Just make a forms.ChoiceField with the data filled in that you need (or else look up the pattern for loading dynamic data into a forms.ChoiceField and do something like that.) If you g

Re: Overriding admin templates

2008-11-01 Thread Low Kian Seong
http://www.djangobook.com/en/1.0/chapter17/ On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote: > > Low Kian Seong wrote: >> You are supposed to put the admin template you want to override in >> your own template directory definition in settings.py >> >> So, if you defined it

Re: Installing an app in a sub-directory of another site (urls question)

2008-11-01 Thread bluefireredsky
Hi, The reason is because of the preceding "/" in your HttpResponseRedirect. You could try to redirect to "success/" or to "../success/" based on which may be applicable to you. Cheers On Nov 1, 5:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I installed my app on a subd

Deploying multiple django applications in a single apache server

2008-11-01 Thread bluefireredsky
Hello, I have followed the link from django documentation on deploying an application to apache2. http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ I have two applications, which I would like to run on two different ports on the server. Basically one being an administrative websi

Installing an app in a sub-directory of another site (urls question)

2008-11-01 Thread [EMAIL PROTECTED]
Hi guys, I installed my app on a subdir of another site (just for staging). www.example.org/djangoapp Now my urls keep pointing back to the root of the other site, breaking navigation. So for example if i POST some form to www.example.org/djangoapp/subscribe/ and then from there issue an Htt

Re: PROFANITIES_LIST for comments

2008-11-01 Thread Tim Chase
> I use default comments form, set in settings.py: > > COMMENTS_ALLOW_PROFANITIES = True Uh...while I speak without looking at any code, or documentation, prima facie, this looks backwards...it sounds like you want "Allow profanities = False" -tim --~--~-~--~~~

PROFANITIES_LIST for comments

2008-11-01 Thread slav0nic
I use default comments form, set in settings.py: COMMENTS_ALLOW_PROFANITIES = True PROFANITIES_LIST = ('viagra', 'porno') But when i post comment with this words - it posted =\ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm
Low Kian Seong wrote: > You are supposed to put the admin template you want to override in > your own template directory definition in settings.py > > So, if you defined it as /home/stava/ name>/template/admin/change_list.html Huh? /L > On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROT

Re: Accessing Model field from ModelForm?

2008-11-01 Thread Daniel Roseman
On Nov 1, 5:33 am, killsto <[EMAIL PROTECTED]> wrote: > I have a basic form that shows what a person entered when it is > submitted.  However, it shows up as a form.CharField (textbox) instead > of model.CharField. Is there a way to access the model's saved data > from the Forms? Also does form_fo

Re: Help to Upload image

2008-11-01 Thread Low Kian Seong
Yeah, if in doubt you can use the forms.as_p first to see what kind of html form it outputs and use that as the basis for creating your form. On Thu, Oct 30, 2008 at 7:05 PM, Giles Thomas <[EMAIL PROTECTED]> wrote: > > please smile wrote: >> Can anybody please tell how to upload a image ?

Re: Using Django

2008-11-01 Thread Low Kian Seong
Finding out a bit about urls.py and how it functions would do a world of good. It is very flexible and powerful once you learn how to wield it. Low Kian Seong http://lowkster.blogspot.com On Sat, Nov 1, 2008 at 5:20 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm new to Djan

Re: multiselect populated by another app

2008-11-01 Thread Low Kian Seong
I think this might be useful: http://www.zoia.org/blog/2007/04/23/using-dynamic-choices-with-django-newforms-and-custom-widgets/ On Fri, Oct 31, 2008 at 5:36 AM, webcomm <[EMAIL PROTECTED]> wrote: > > Bump. > > There must be a way to do this, right? I have looked all over... the > documentation

Re: Overriding admin templates

2008-11-01 Thread Low Kian Seong
You are supposed to put the admin template you want to override in your own template directory definition in settings.py So, if you defined it as /home/stava//template/admin/change_list.html On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote: > > I'd like to override part

Overriding admin templates

2008-11-01 Thread Lars Stavholm
I'd like to override part of an admin change_list template. Reading the documentation, my understanding is that I can place a template in a certain place in the templates directory hierarchy, and django will look for it and use it, i.e.: templates/admin/build/job/change_list.html ...where "buil

Re: HttpRequest with chunked encoding is not buffered

2008-11-01 Thread Graham Dumpleton
On Nov 1, 10:40 am, "Tomáš Brambora" <[EMAIL PROTECTED]> wrote: > I have a standard Django installation without any changes in the > settings (except adding mysql db to the settings.py) and I'm sending > the message to localhost:8000, so there is no proxy or anything else > in the way. Still, th

Re: Templaite:display li items alternatively using for

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 1:58 AM, Xian Chen <[EMAIL PROTECTED]> wrote: > Hi, > > I want to display a list of items by using {% for item in items %}. > > To make the web pages look better, I want to use two kinds of > alternatively. > > E.G item >item > > My question is how can i use the tag