Re: Using % with psycopg2

2008-12-02 Thread Thomas Guettler
Siah schrieb: > Hi, > > The following code fails on windows, and works just fine on my unix > box. To fix the problem in windows, I must replace('%', '%%') so its > internal string formatting doesn't fail on me. Should I file this bug > for psycopg2? > > from django.db import connection > cursor=c

Re: Local flavor and admin (zip-code)

2008-12-02 Thread sergioh
On Dec 1, 11:14 am, Fabio Natali <[EMAIL PROTECTED]> wrote: > Hi everybody! > > I'm having difficulties while trying to insert a zip-code field in one > of my models. I'd like to rely upon some italian local flavor stuff, > so to get some validation for free. > > Here comes my models.py: > > fro

Re: inline forms/subforms: how to use inlineformset_factory ?

2008-12-02 Thread Dominic Ashton
> > Did you happen to read the official Django documentation on model > formsets? In model formsets there are two factory functions. > modelformset_factory and inlineformset_factory. The latter is a subset > of the former and makes it easier to work with related objects through > a foreign key. T

How to randomize a sliced query set?

2008-12-02 Thread Benjamin Buch
Hi, I'd like to have a sliced query set in random order. I tried coupon_items = Item.objects.order_by('?')[:25] ,it seemed to work first but than I noticed that coupon_items consists of doubled items (although all Item objects are distinct). coupon_items = Item.objects.all()[:25].order_by('

Re: How to randomize a sliced query set?

2008-12-02 Thread Tim Chase
> coupon_items = Item.objects.all()[:25] > random.shuffle(coupon_items) > > doesn't word because a QuerySet object does not support item > assignment, which is used by random.shuffle. You might be able to cast the queryset as a list and then use random.shuffle: coupon_items = list(Item.ob

Re: Model similar to a spreadsheet

2008-12-02 Thread bruno desthuilliers
On 1 déc, 20:10, Stefan <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to Django and have some problems on how to create the models. > > What I want to do is something similar to a spreadsheet, but with more > than one data field per intersection. > > Basically like this: (http://dpaste.com/hold/

Re: XML templates

2008-12-02 Thread Vicky
I did as you said. Still its giving the same error :( On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-12-01 at 22:20 -0800, Vicky wrote: > > I tried the code below: > > > from django.template import loader, Context > > > def NewspaperSelect(request,u_id): > >  

Re: replacing a contrib class

2008-12-02 Thread Rajesh Dhawan
> > I want to define a class inherited from a contrib class namely users > and replace it with the new one . > Long ago there was a replace_module keyword in the meta class of the > model , any idea how to achieve > this ? First of all, why do you want to replace the contrib User model with your

Re: Question from django beginner

2008-12-02 Thread Rajesh Dhawan
> > 2. Is there any built-in opton in Django (0.97 version) to unzip > files. I would need to unzip the file to a folder once the upload has > been done. Python provides libraries to handle zip files. Here's the starting point: http://www.python.org/doc/2.5.2/lib/archiving.html -Rajesh D --~--~

Re: XML templates

2008-12-02 Thread Eric Abrahamsen
On Dec 2, 2008, at 5:50 PM, Vicky wrote: > > I did as you said. Still its giving the same error :( Are you using forward slashes instead of backslashes? The docs indicate that's necessary... > > > > > > On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: >> On Mon, 2008-12-0

Re: time help (again)

2008-12-02 Thread Praveen
Before getting the value you must check of its types which type is you can not find the difference between DateObject-StrObject so you have to have same kind of datatype second thing open your terminal write python >>import datetime >>help(datetime) which will list you all the function. there is o

Re: Question from django beginner

2008-12-02 Thread James Bennett
On Tue, Dec 2, 2008 at 3:42 AM, Vince <[EMAIL PROTECTED]> wrote: > 2. Is there any built-in opton in Django (0.97 version) to unzip There is no such thing as "Django 0.97". Releases of Django are as follows: 0.90 0.91 0.95 0.96 1.0 (with minor bugfix releases on several of them, like "0.96.1" a

Many-to-Many to exists table

2008-12-02 Thread nucles
Hello Django-People, we use the embedded functionality of the user authentication in Django. We use folowing models: "user", "auth_group", "auth_user_group" and other embedded models that does not matter in this context. We would like to add the additional entity "area" with M-to-M relation to th

Re: Many-to-Many to exists table

2008-12-02 Thread Thomas Guettler
If I understood you problem: {{{ from django.contrib.auth.models import Group class Area(models.Model): groups=models.ManyToManyField(Group) }}} This creates a Many-To-May relation to Group. Copied from brain to keyboard (untested) HTH, Thomas nucles schrieb: > Hello Django-People, > >

Re: Configuring Paths for FileField ?

2008-12-02 Thread bruno desthuilliers
On 2 déc, 08:58, Eric <[EMAIL PROTECTED]> wrote: > Hi! > > I'm new at Django, but I've been having relatively good luck. I've > recently hit a big of a wall using FileField. I have set up the paths > correctly enough that I can upload files to /my_site/uploads/photos, > but when I view the mo

Re: Custom inline form

2008-12-02 Thread mrsource
I find the problem: The validation was performed also on new extra widget because I have added a field that was always valorized then the self.has_changed property was always true then the validation was performed also for the new extra widget. Now the field is empty by default. But now another p

Re: Local flavor and admin (zip-code)

2008-12-02 Thread Fabio Natali
Dear Sergio, thank you very much for your reply. sergioh wrote: [...] > from django.contrib.localflavor.it.forms import ITZipCodeField > from django import forms > from django.utils.translation import ugettext_lazy as _ > > class DittaDipendentiAdmin(admin.ModelAdmin): > cap = ITZipCodeFiel

Re: inline forms/subforms: how to use inlineformset_factory ?

2008-12-02 Thread Dominic Ashton
> > I did read this documentation, and was confused because I read this: > > >>> from django.forms.models import inlineformset_factory > >>> BookFormSet = inlineformset_factory(Author, Book) > >>> author = Author.objects.get(name=u'Orson Scott Card') > >>> formset = BookFormSet(instance=author >

Re: admin.py -- AlreadyRegistered

2008-12-02 Thread please smile
hi, class BookAdmin(admin.ModelAdmin): pass # admin.site.register(Book, BookAdmin) Just put '#' in front of admin.site.register(Book, BookAdmin) .Now run the server ,if it s ok then remove the # On Tue, Dec 2, 2008 at 12:47 PM, Roland van Laar <[EMAIL PROTECTED]> wrote: > > djan wrote: > >

Question from django beginner

2008-12-02 Thread Vince
Hi everyone, I'm new to django so perhaps those are really simple questions so sorry about that: I had an php page already working (css formatted, imgs and everything), it's a very simple page for uploading zip files to a server. The server (system Apache 2.2.4 with django) has already the main

replacing a contrib class

2008-12-02 Thread Sandro
Hi Everybody, I want to define a class inherited from a contrib class namely users and replace it with the new one . Long ago there was a replace_module keyword in the meta class of the model , any idea how to achieve this ? --~--~-~--~~~---~--~~ You received th

Query API: get all users without a group

2008-12-02 Thread Thomas Guettler
Hi, I want to get all objects where the corresponding many-to-many field is empty. Example: get all users without a group My solution: User.objects.exclude(groups__in=Group.objects.all()) I think this is not optimal, since Group.objects.all() gets evaluated. Resulting SQL: SELECT "auth_

Re: How to randomize a sliced query set?

2008-12-02 Thread Benjamin Buch
Worked like a charm... Thanks! > >> coupon_items = Item.objects.all()[:25] >> random.shuffle(coupon_items) >> >> doesn't word because a QuerySet object does not support item >> assignment, which is used by random.shuffle. > > You might be able to cast the queryset as a list and then use > random

Re: How can I use more than 24 hours in TimeField?

2008-12-02 Thread Thomas Guettler
Hi, Maybe my TimedeltaField helps you: http://www.djangosnippets.org/snippets/1060/ K*K schrieb: > As you know time data type in mysql allow to be used more than 24 > hours, but when there is a more than 24 hours record in the table > such as 72:00:00, and then query the table with Django ORM,

admin css, is this still supported?

2008-12-02 Thread John M
I've searched for the admin CSS guide, and found it deprecated (http:// docs.djangoproject.com/en/dev/obsolete/admin-css/?from=olddocs), is there a replacement? Thanks, John M --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Why run two web-servers on the same host?

2008-12-02 Thread walterbyrd
All the python frameworks seem to do this: one web-server for development, another for production. There may be a good reason for this, but I don't see it. If you are doing internet development, then you certainly have a network. So why not develop on one box, and then move the files to another?

Re: How to return Admin to previous filters after save?

2008-12-02 Thread cyberjack
Thanks, that's good to know. -Josh --~--~-~--~~~---~--~~ 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 emai

Re: Query API: get all users without a group

2008-12-02 Thread Filip Wasilewski
On 2 Gru, 16:45, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Hi, > > I want to get all objects where the corresponding many-to-many field is > empty. > > Example:  get all users without a group [...] The preferred solution is using the `isnull` filter: User.objects.filter(groups__isnull=True)

Re: Why run two web-servers on the same host?

2008-12-02 Thread bruno desthuilliers
On 2 déc, 17:46, walterbyrd <[EMAIL PROTECTED]> wrote: > All the python frameworks seem to do this: one web-server for > development, another for production. There may be a good reason for > this, but I don't see it. Err... Not breaking whatever on the production server, perhaps ? FWIW, this is n

Re: Configuring Paths for FileField ?

2008-12-02 Thread Eric
Thanks! That's really helpful. So, in a production environment, you'd set up the MEDIA_ROOT to be somewhere within the generally accessible web-root, right? -E On Dec 2, 3:28 am, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 2 déc, 08:58, Eric <[EMAIL PROTECTED]> wrote: > > > Hi! > > > I

Re: Why run two web-servers on the same host?

2008-12-02 Thread Daniel Roseman
On Dec 2, 4:46 pm, walterbyrd <[EMAIL PROTECTED]> wrote: > All the python frameworks seem to do this: one web-server for > development, another for production. There may be a good reason for > this, but I don't see it. > > If you are doing internet development, then you certainly have a > network.

Re: Database model fields question

2008-12-02 Thread sned
Thanks for pointing me in the right direction. Here's the solution I came up with: import socket, struct class ipfield(models.Field): __metaclass__ = models.SubfieldBase def db_type(self): return 'integer' def to_python(self, value): retu

Re: Model similar to a spreadsheet

2008-12-02 Thread Stefan
Bruno: Thanks, I think that is exactly what I needed. I thought that I might need a model for the entries (you called them PersonItem), but I wasn't sure since I'm new to this kind of programming and thought there might be a more efficient way. Dan: Just imagine a spreadsheet, like OpenOffice Cal

Re: Query API: get all users without a group

2008-12-02 Thread [EMAIL PROTECTED]
You could do User.objects.exclude(groups__in=Group.objects.all ().query) which will actually generate a subquery. Alex On Dec 2, 10:45 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Hi, > > I want to get all objects where the corresponding many-to-many field is > empty. > > Example:  get all u

Re: time help (again)

2008-12-02 Thread Adrian Klaver
On Monday 01 December 2008 9:01:11 pm Bobby Roberts wrote: > > http://www.python.org/doc/2.5.2/lib/datetime-timedelta.html > > yeah i said I don't understand this. I found datetimes easier to deal with when I used the modules found here: http://labix.org/python-dateutil As as an example for

Re: Ordering a ManyToManyField with "through" relation

2008-12-02 Thread scelerat
I'm coming late to this thread -- this example is exactly what I was looking for, so thanks for posting this. I'm doing something where I want admins to be able to define an arbitrary number of Collections which are just different orderings and combinations of a (relatively) small set of Things.

Dreamhost django solution (script)

2008-12-02 Thread Gabriel Falcão
I worked in a script that makes a full django environment setup on dreamhost http://gabrielfalcao.com/2008/12/02/hosting-and-deploying-django-apps-on-dreamhost/ Hope whis help someone! -- :wq Atenciosamente __

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-02 Thread rcoup
On Nov 26, 6:07 am, Justin Bronn <[EMAIL PROTECTED]> wrote: > I created an Ubuntu 8.10 VM to try and test out this problem. > However, the only way that I could reproduce your exact problem > (segfault upon HTTP request) is when using the mpm-worker (threaded) > Apache.  When using the prefork,

Non-displayed fields on admin form get overwritten

2008-12-02 Thread borntonetwork
Hi. I am using Django v1.0. When I use the "fields" attribute in my model to tell the admin interface what fields to display on the change form, I find that any fields I leave out get truncated when I use the form to update a record. For instance, say I have a model class called "Users" that has

Re: replacing a contrib class

2008-12-02 Thread Sandro
Hi , I did considered , but I could not see how to do it , the model I want to inherit is from contrib.Users and the model I want to replace is contrib.Users . It looks to me like a circular reference ...?? How can I use the inherited model in the model I inherited from ?? Sandro On Dec 2, 12:1

Re: Displaying items of a linked object in a template

2008-12-02 Thread Marco
@Daniel and Bruno, Thanks a lot it is working ! --~--~-~--~~~---~--~~ 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,

forms.ModelMultipleChoiceField

2008-12-02 Thread Alfredo Alessandrini
Hi, I've set the player form with: class PlayerForm(forms.Form): challengeable = forms.BooleanField(required=False) show_name = forms.BooleanField(required=False) country = forms.ModelMultipleChoiceField(queryset=Country.objects.all()) and the template with: I've a problem to se

Re: forms.ModelMultipleChoiceField

2008-12-02 Thread Daniel Roseman
On Dec 2, 9:04 pm, "Alfredo Alessandrini" <[EMAIL PROTECTED]> wrote: > Hi, > > I've set the player form with: > > class PlayerForm(forms.Form): >     challengeable = forms.BooleanField(required=False) >     show_name = forms.BooleanField(required=False) >     country = forms.ModelMultipleChoiceFie

Re: testing template tags

2008-12-02 Thread Richard Szopa
Thanks a lot. For some reason I haven't noticed the relevant fragment in the docs... Cheers, -- Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Non-displayed fields on admin form get overwritten

2008-12-02 Thread Rajesh Dhawan
> I am using Django v1.0. When I use the "fields" attribute in my model > to tell the admin interface what fields to display on the change form, > I find that any fields I leave out get truncated when I use the form > to update a record. > > For instance, say I have a model class called "Users" th

Re: replacing a contrib class

2008-12-02 Thread Rajesh Dhawan
> I did considered , but I could not see how to do it , the model I want > to inherit is from > contrib.Users and the model I want to replace is contrib.Users . > It looks to me like a circular reference ...?? > How can I use the inherited model in the model I inherited from ?? It's still not cle

Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread Opel
I have been following along to the excellent James Bennet Book, Practical Django Projects and he suggests creating apps in a directory that can be reusable for local development. I am working on OSX (tiger and Leopard on different machines) and I have created a Django director inside my /User/Sit

Re: Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread Dan
I prefer to to just put the apps in the project's folder and put *that* folder on the PYTHONPATH then move it elsewhere only when I find out I actually need it elsewhere. To make it more portable, I find out where my project is in my filesystem at runtime so if I move it around, it's no problem. S

Re: Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread Opel
Thanks for the reply I'll give that a try. Just one question does that mean you make a structure like so ? Project settings.py urls.py etc __init__.py (this is where above code goes) >>>apps >blog >>>__init__.py >>>models.py >>>views.py so that means in your installed_apps you

modelformset_factory error: (Hidden field id) with this None already exists.

2008-12-02 Thread cyberjack
Hi all, I've been stumped by this error for the past few days and haven't made any progress. Could someone please help out? I've created a formset of seven entries, one for each day of the previous week. The first submission works fine; all seven entries are successfully submitted. Subsequent s

Re: Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread James Bennett
For what it's worth, I'm a huge fan of virtualenv: http://pypi.python.org/pypi/virtualenv and of Doug Hellmann's virtualenvwrapper: http://www.doughellmann.com/projects/virtualenvwrapper/ What virtualenv does, basically, is create an isolated Python environment into which you can install stuff

Re: Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread Dan
That would work but I put them right at the root of my project, not in an app folder so I just add 'blog' to my INSTALLED_APPS. Every distributable app I saw is meant to be put somewhere directly in the PYTHONPATH and not in a subpackage so I follow that rule. If you put them inside an folder name

Re: Adjusting PYTHONPATH for reusable django apps

2008-12-02 Thread Opel
Thanks for both tips. James I will trial the virtual environment and if I get stuck can use Dan's method. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

How to create and send a pdf attachment

2008-12-02 Thread Epinephrine
Does anyone have a code sample that shows how to create a pdf document and then, without saving that document to disk, email it as an attachment? I am using the ReportLab PDF library at the platypus level for pdf creation. For emailing, I expect to use Django's EmailMessage class. Thanks! --~

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-02 Thread rcoup
Posting to geos-devel, I got this reply from Paul Ramsey: http://lists.osgeo.org/pipermail/geos-devel/2008-December/003800.html Leading me to: http://sgillies.net/blog/829/shapely-1-0-8/ "The same problem [segfault] could afflict any python package that uses Ctypes on 64-bit systems without expl

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-02 Thread rcoup
On Dec 3, 1:40 pm, rcoup <[EMAIL PROTECTED]> wrote: > Leading me to:http://sgillies.net/blog/829/shapely-1-0-8/ > > "The same problem [segfault] could afflict any python package that > uses Ctypes on 64-bit systems without explicitly marking argument and > return types. " The relevant changeset i

problem saving form data in sams "24 hour" book example

2008-12-02 Thread Margie
I'm a new user to django and am attempting to go through the Sams "Teach Yourself Django in 24 hours" book and am having an issue related to the chapter on saving form data. I'm hoping someone can give me a hand. I'm using Django 1.0 Here's my model: class Person(models.Model): userID = m

Re: problem saving form data in sams "24 hour" book example

2008-12-02 Thread Colin Bean
On Tue, Dec 2, 2008 at 5:09 PM, Margie <[EMAIL PROTECTED]> wrote: > > I'm a new user to django and am attempting to go through the Sams > "Teach Yourself Django in 24 hours" book and am having an issue > related to the chapter on saving form data. I'm hoping someone can > give me a hand. > > I'm

how to create json from template?

2008-12-02 Thread Viktor Nagy
Hi, I know about the serialisation framework, but with MultiResponse[1] you can't really use it (and anyway I don't know how to customise it extensively). As a result I would like to create json with the django template engine. An example code would be this: [{% for poll in data %} {"question":

Re: problem saving form data in sams "24 hour" book example

2008-12-02 Thread Margie
Thank you so much - that was a huge help! Margie On Dec 2, 5:17 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote: > On Tue, Dec 2, 2008 at 5:09 PM, Margie <[EMAIL PROTECTED]> wrote: > > > I'm a new user to django and am attempting to go through the Sams > > "Teach Yourself Django in 24 hours"  book an

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-02 Thread GRoby
I can confirm that all of my seg faults were all on my 64 bit machine but could not be duplicated when I tried to on my 32 bit test virtual machines. On Dec 2, 7:40 pm, rcoup <[EMAIL PROTECTED]> wrote: > Posting to geos-devel, I got this reply from Paul > Ramsey:http://lists.osgeo.org/pipermail

Preserving pretty HTML output

2008-12-02 Thread Tonne
I am interested to see if anyone could share their solutions for ensuring pretty HTML output. I have found achieving it to be a very uncomfortable compromise in that I seem to need to make my templates almost unreadable to do so, which isn't really a practical solution. Perhaps nicely formatted

Re: XML templates

2008-12-02 Thread Eric Abrahamsen
On Dec 2, 2008, at 5:50 PM, Vicky wrote: > > I did as you said. Still its giving the same error :( Do you have the correct permissions on the TEMPLATE_DIRS directories? Have you written the paths with forward slashes? That's all I can think of. E > > > > On Dec 2, 11:38 am, Malcolm Tredin

Re: Non-displayed fields on admin form get overwritten

2008-12-02 Thread borntonetwork
Thank you for your reply, Rajesh. The two fields in question are actually "pending_referrer_name" and "pending_referrer_email". In the admin class code below, I include them in the fields attribute. However, initially I did not and that is when the problem would occur. Here is the model code: cl

Re: Why run two web-servers on the same host?

2008-12-02 Thread Kenneth Gonsalves
On Tuesday 02 Dec 2008 10:16:48 pm walterbyrd wrote: > All the python frameworks seem to do this: one web-server for > development, another for production. There may be a good reason for > this, but I don't see it. it is not compulsory to use it - I develop and deploy using apache and mod_python

Re: time help (again)

2008-12-02 Thread Kenneth Gonsalves
On Tuesday 02 Dec 2008 7:53:25 pm Praveen wrote: > second thing open your terminal write python > > >>import datetime > >>help(datetime) dir(datetime) -- regards KG http://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are sub

Re: Why run two web-servers on the same host?

2008-12-02 Thread Kenneth Gonsalves
On Wednesday 03 Dec 2008 8:49:31 am Kenneth Gonsalves wrote: > > All the python frameworks seem to do this: one web-server for > > development, another for production. There may be a good reason for > > this, but I don't see it. > > it is not compulsory to use it - I develop and deploy using apach

Re: admin.py -- AlreadyRegistered

2008-12-02 Thread djan
Thanks for the replies. I restarted the dev server (and even my x session). I first tried: class BookAdmin(admin.ModelAdmin): pass #admin.site.register(Book, BookAdmin) class AuthorAdmin(admin.ModelAuthor): pass #admin.site.register(Author, AuthorAdmin) class PublisherAdmin(admin.ModelP

Re: admin.py -- AlreadyRegistered

2008-12-02 Thread djan
Thanks for the replies. I restarted the dev server (and even my x session). I first tried: class BookAdmin(admin.ModelAdmin): pass #admin.site.register(Book, BookAdmin) class AuthorAdmin(admin.ModelAuthor): pass #admin.site.register(Author, AuthorAdmin) class PublisherAdmin(admin.ModelP

Re: admin.py -- AlreadyRegistered

2008-12-02 Thread djan
Pardon me. I incorrectly followed the suggestion, should have been the following in admin.py: admin.site.register(Book) admin.site.register(Author) admin.site.register(Publisher) What is the difference between this and, say, class BookAdmin(admin.ModelAdmin): pass admin.site.register(Book, B

Re: admin css, is this still supported?

2008-12-02 Thread Malcolm Tredinnick
On Tue, 2008-12-02 at 08:21 -0800, John M wrote: > I've searched for the admin CSS guide, and found it deprecated (http:// > docs.djangoproject.com/en/dev/obsolete/admin-css/?from=olddocs), is > there a replacement? You can still customise the admin CSS. I suspect it just hasn't been documented

Re: Preserving pretty HTML output

2008-12-02 Thread Malcolm Tredinnick
On Tue, 2008-12-02 at 18:39 -0800, Tonne wrote: > I am interested to see if anyone could share their solutions for > ensuring pretty HTML output. > > I have found achieving it to be a very uncomfortable compromise in > that I seem to need to make my templates almost unreadable to do so, > which

Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-12-02 Thread Andre P LeBlanc
Confirmed also. only happens on my 64-bit machine, and is not related to apache at all as I can reproduce it faithfully in ipython. On Dec 2, 8:32 pm, GRoby <[EMAIL PROTECTED]> wrote: > I can confirm that all of my seg faults were all on my 64 bit machine > but could not be duplicated when I trie

Re: change i18n language through hyperlinks

2008-12-02 Thread Ozgur Odabasi
try this def set_language(request, lang_code): next = request.REQUEST.get('next', None) if not next: next = '/' response = http.HttpResponseRedirect(next) if lang_code and check_for_language(lang_code): settings.LANGUAGE_CODE=lang_co

Re: how to create json from template?

2008-12-02 Thread Alex Koshelev
To trim last colon wrap it with if statement: {% if forloop.revcounter0 %},{% endif %} On Wed, Dec 3, 2008 at 04:26, Viktor Nagy <[EMAIL PROTECTED]> wrote: > Hi, > > I know about the serialisation framework, but with MultiResponse[1] you > can't really use it (and anyway I don't know how to cust

Re: how to create json from template?

2008-12-02 Thread David Zhou
On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > To trim last colon wrap it with if statement: > > {% if forloop.revcounter0 %},{% endif %} You can also do: {% if not forloop.last %},{% endif %} Which, IMO, is slightly more clear. --- David Zhou [EMAIL PROTECTED]

Re: how to create json from template?

2008-12-02 Thread Alex Koshelev
Oh, Yes. Good point. On Wed, Dec 3, 2008 at 09:49, David Zhou <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > To trim last colon wrap it with if statement: > > > > {% if forloop.revcounter0 %},{% endif %} > > You can also do: > > {%

How to delete template fragment cache?

2008-12-02 Thread Bartek SQ9MEV
Hi all, I'm quite newbie in Django. I use template fragment caching ({% cache ...%}...{% endcache %}. This fragment changes rather seldom, changes originate only from admin site, są for me its obvious to delete cache at adding objects from admin, and use quite large tiemeout for my caches. How ca