Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread mattimust...@gmail.com
On Dec 28, 10:01 am, "Russell Keith-Magee" wrote: > On Sun, Dec 28, 2008 at 5:32 AM, adambossy wrote: > > > Russ, > > > Thanks for the reply. Specifically, I am wondering if there is some > > feature of the Models API that allows me to retrieve the

dynamic load urls.py problem

2008-12-27 Thread strelnikovdmitrij
hi guys...me again...but now I've done a little step forward, when I load urls file through request.urlconf it does not append end slash to any url..:( and urls without trailing slash try map through base urls.py file (ROOT_URLCONF). in new url.py file I specify urlpatterns = pattern() not +=. It

Re: wondering how to do something similar to save_model for inline.

2008-12-27 Thread Timboy
Great link. I was really excited to try it. Here is my new inline: class rentalInline(admin.TabularInline): model= Rent extra = 3 raw_id_fields = ('movie',) exclude = ['rented_by'] def save_formset(self, request, form, formset, change): instances =

Re: wondering how to do something similar to save_model for inline.

2008-12-27 Thread alex.gay...@gmail.com
Take a look at the save formset method: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#save-formset-self-request-form-formset-change On Dec 27, 6:46 pm, Timboy wrote: > I have an admin object where I want to pass in the request.user on > save. It works fine in my

Re: Fastest way to import datas into a database

2008-12-27 Thread Benjamin Sergeant
On Fri, Dec 26, 2008 at 2:34 AM, Russell Keith-Magee wrote: > > On Thu, Dec 25, 2008 at 9:02 AM, bsergean wrote: > > > > Hi all, > > > > I'm populating my database manually using a script that create ORM > > objects and save them... I have a lot of

wondering how to do something similar to save_model for inline.

2008-12-27 Thread Timboy
I have an admin object where I want to pass in the request.user on save. It works fine in my normal admin class but not for the inline version. (works fine here): class RentAdmin(admin.ModelAdmin): exclude = ['rented_by'] list_display = ('renter', 'movie', 'late', 'owed', 'paid',

Re: How to create middleware that adds context variables?

2008-12-27 Thread Roy
Ah, as a noob I was not aware of context processors! Thanks! On Dec 28, 5:13 am, bruno desthuilliers wrote: > On 27 déc, 17:42, Roy wrote: > > >  How to create middleware that adds context variables? > > Hi, anyone have any examples of the

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread Russell Keith-Magee
On Sun, Dec 28, 2008 at 5:32 AM, adambossy wrote: > > Russ, > > Thanks for the reply. Specifically, I am wondering if there is some > feature of the Models API that allows me to retrieve the foreign key > object so that it is included in the serialized string. That is, >

How to modify cleaned_data of a ModelChoice field?

2008-12-27 Thread Daniel Bachler
Hi, I am fairly new to django, so if I missed a piece of documentation that would describe what I want to do please feel free to redirect me, I may have missed it in my search. I have a pretty simple problem that I cannot quite get my head around. I have a Many To Many relationship between

Re: Invalid block tag: 'get_comment_count'

2008-12-27 Thread Russell Keith-Magee
On Sun, Dec 28, 2008 at 12:27 AM, Florian Lindner wrote: > > Hello, > > I'm trying to use the comment framework from Django 1.0.2. > > I've followed all the steps in > http://docs.djangoproject.com/en/dev/ref/contrib/comments/ > > (added it to installed apps, added to

Django Comments framework

2008-12-27 Thread stereoit
Hi, I tried to add comments app http://docs.djangoproject.com/en/dev/ref/contrib/comments/, now few things works but Preview sometimes acts as Submit when there are no errors and I have no idea how to override Posted screen to include link (or just redirect) to original page. The documentation

Re: How to create middleware that adds context variables?

2008-12-27 Thread bruno desthuilliers
On 27 déc, 17:42, Roy wrote: > How to create middleware that adds context variables? > Hi, anyone have any examples of the above? What's wrong with context processors ? http://docs.djangoproject.com/en/dev/ref/templates/api/?#writing-your-own-context-processors

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread adambossy
Russ, Thanks for the reply. Specifically, I am wondering if there is some feature of the Models API that allows me to retrieve the foreign key object so that it is included in the serialized string. That is, without writing my own serializer (which I suspect I may have to do). Alternatively, I

Re: front facing poll form issues

2008-12-27 Thread Kevin
No one has offered any help. That's fine, so let me ask my question differently. Can anyone point me to an example of form processing for formsets? Let's say can_delete=True, how do I process that in my code? I have scoured google and can find no examples, so any examples/links would be

Re: django i18n for google

2008-12-27 Thread Antoni Aloy
2008/12/27 Alessandro Ronchi : > Il 16 dicembre 2008 19.20, Alessandro Ronchi > ha scritto: >> When google spiders our i18n translated django websites, does it try >> and indicize all languages? is it possible to force the language by a

Passing arguments to Admin index in Django 1.0

2008-12-27 Thread raj
Hi all, I'm new to Django, started out with 0.96 and very soon switched to 1.0 version. Here, I'm facing the following problem. My Admin index page needs to have a small custom form snippet in addition to all other usual things. It will be accommodated in the admin_index page as follows: {%

urls config and slash append

2008-12-27 Thread strelnikovdmitrij
I have middleware where I dynamically load (request.urlconf) urls.py for each subdomain (application)..if I used (r'^(?P[a-zA-Z0-9-] {4,20})/$', 'user'), its work with end slash and without, but (r'^(? P[a-zA-Z0-9-]{4,20})/new/$', 'new'), works only with end slash..why? I really dont understand

slash append

2008-12-27 Thread strelnikovdmitrij
hi all:) I have middleware where I dynamically (request.urlconf) load urls.py for each subdomain (django application).. if I used (r'^(?P[a-zA-Z0-9-]{4,20})/$', 'user'), its work with end slash and without, but (r'^(?P[a-zA-Z0-9-]{4,20})/new/$', 'new'), works only with end slash..why? I would

Re: displaying correct image url

2008-12-27 Thread garagefan
the ability to edit posts would be nice :) i figured out the issue and am now displaying relative urls to the images. now, to edit the delete function to remove the thumbnails as well... On Dec 27, 1:21 pm, garagefan wrote: > currently, self.image.name displays the

displaying correct image url

2008-12-27 Thread garagefan
currently, self.image.name displays the absolute server path... i want to change this so that when i call it, it either display the relative path, or an absolute path for the website itself. so instead of displaying /home/site/mysite/images/gallery/ imagename.jpg it will display

How to create middleware that adds context variables?

2008-12-27 Thread Roy
Hi, anyone have any examples of the above? --~--~-~--~~~---~--~~ 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

parametr selected="selected"

2008-12-27 Thread Buddy
Hi. I want to have html-code: 3 I do try it with forms.py: pos = ( (1,1), (2,2), (3,3), ) field1 = forms.CharField( widget=forms.widgets.Select(choices=pos)) but I get strings which not have parametr selected="selected". How need change it so as to get it? Thanks

Re: Problem with url tag

2008-12-27 Thread patrick91
Resolved, if I could say so :) the problem was that I can't use reverse in forms.py 'cause is to early for doing that :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Invalid block tag: 'get_comment_count'

2008-12-27 Thread Florian Lindner
Hello, I'm trying to use the comment framework from Django 1.0.2. I've followed all the steps in http://docs.djangoproject.com/en/dev/ref/contrib/comments/ (added it to installed apps, added to urls.py and loaded in the template) but I get: TemplateSyntaxError at /blog/1/ Invalid block

Re: Dynamic model field

2008-12-27 Thread sergioh
Maybe a better approach for this, can be override the save method for your model and also exclude that field on your forms. Actually there is a post from James Bennett at: http://www.b-list.org/weblog/2008/dec/24/admin/ hope it helps, regards, Sergio Hinojosa On Dec 26, 6:32 pm, eldonp2

Re: Traceback in the ``runserver`` console

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 2:32 AM, Fridrik Mar Jonsson wrote: > > Hi Djangonians, > > I recently had an instance where it would have been really convenient > to see the error and a traceback in the ``runserver`` console instead > of just a single line telling me that the

Re: Calculate and store the average rating

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 7:48 AM, eldonp2 wrote: > > Is there a way to calculate and store the average rating in this > example: It's not entirely clear which part of this problem you want help with. - Computing the average rating. The brute force approach would be to

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 2:11 PM, adambossy wrote: > > I have a model that refers to a ForeignKey, e.g.: > > class Template(models.Model): > type = models.ForeignKey(Type) > ... > > class Type(models.Model) > name = models.CharField(max_length=32) > ... > > I can fetch

Re: django i18n for google

2008-12-27 Thread Alessandro Ronchi
Il 16 dicembre 2008 19.20, Alessandro Ronchi ha scritto: > When google spiders our i18n translated django websites, does it try > and indicize all languages? is it possible to force the language by a > GET var (for example _code=en) ? I think it's a critical problem.

Re: enumerate in templates

2008-12-27 Thread Alex Koshelev
{% for %} itself On 12/27/08, Vicky wrote: > > Is there a way to access the previous value of a for loop in > templates. Can anyone tell the template representation for the python > code like: > > for i,j in enumerate(item): >

Re: Getting value of field from form.

2008-12-27 Thread Antoni Aloy
2008/12/27 evenrik : > > So I need to display the data for a form field from the post or from > the instance if no post. This works but I am hoping there is a better > way: > > {% if form.is_bound %} >{{ form.data.foo }} > {% else %} >{{ form.instance.foo }} >