Guidelines for changing the default encoding of a Django site

2010-11-16 Thread George Sakkis
Hi all, sorry for reposting this from stackoverflow [1] but I'm hoping to hear from more people who may have experience with this sort of thing. Django comes with unicode support out of the box and it supports utf-8 by default. Say that you have developed, debugged and tested successfully a site

Re: www.djangoproject.com

2010-07-15 Thread George Sakkis
On Jul 15, 1:14 pm, Tom Evans <tevans...@googlemail.com> wrote: > On Thu, Jul 15, 2010 at 11:02 AM, George Sakkis <george.sak...@gmail.com> > wrote: > > On Jul 15, 4:55 am, Danny Adair <danny.ad...@unfold.co.nz> wrote: > > >> Hi, > > >> I

Re: www.djangoproject.com

2010-07-15 Thread George Sakkis
On Jul 15, 4:55 am, Danny Adair wrote: > Hi, > > I had the exact same problem, and I had _not_ installed Weave. > The offending config entry in my case was: > "chrome://global/locale/intl.properties" > and it was at the bottom of the accepted languages list. This is on

Re: www.djangoproject.com

2010-07-14 Thread George Sakkis
On Jul 12, 3:59 pm, Andi wrote: > On Jul 12, 3:40 pm, Nick Raptis wrote: > > > Yea, for some reason, my thoughts went to Weave too. Maybe it has > > something to do with it, maybe it doesn't. Haven't got any more trouble > > since I fixed it though. > >

Re: break/continue for templates

2010-07-05 Thread George Sakkis
On Jul 5, 2:25 pm, Torsten Bronger <bron...@physik.rwth-aachen.de> wrote: > Hall chen! > > George Sakkis writes: > > [...] > > > To be honest, I never *had to* do it (in the strict sense) either > > but apparently others did ([1-4]). As for the "just p

Re: break/continue for templates

2010-07-05 Thread George Sakkis
On Jul 5, 10:17 am, "euan.godd...@googlemail.com" wrote: > The link to your snippet doesn't work for me. Sorry, it was accidentally double posted and the original was deleted. Here it is now: http://djangosnippets.org/snippets/2093/. > It sounds like a neat idea.

break/continue for templates

2010-07-04 Thread George Sakkis
Hi all, there have been at least three threads in this list alone from people asking how to "break" from a for loop in templates, so the following snippet [1] might be useful to some. Leaving aside the "thou shalt not use logic in templates" religious debate, it's interesting in that it is

Re: www.djangoproject.com

2010-07-01 Thread George Sakkis
On Jul 1, 8:41 pm, Carsten Fuchs wrote: > Hi all, > > Am 01.07.2010 19:40, schrieb FC: > > > I can't accesswww.djangoproject.comfrom Buenos Aires, Argentina. > > Firefox says: "The connection has timed out" > > > Is anyone else having problems? > > I experience the same

Re: form class

2010-04-23 Thread George Sakkis
On Apr 23, 9:52 am, xpanta wrote: > Hi, > > I wanted to ask if I am somehow "obliged" to use the form class > provided by Django framework. I can see its use on "static" forms (eg. > registration forms or account forms) but most of the forms I write are > "dynamic" (forms that

Field.to_python() clarification

2010-04-01 Thread George Sakkis
The docs say about Field.to_python(): """ As a general rule, the method should deal gracefully with any of the following arguments: * An instance of the correct type (e.g., Hand in our ongoing example). * A string (e.g., from a deserializer). * Whatever the database returns for the

Customize the InlineModelAdmin forms conditionally

2009-02-06 Thread George Sakkis
I'm trying to customize the admin interface so that each inline form for a given InlineModelAdmin is displayed differently, based on the instance to be edited in the form. For example, one may want to display each BookInline form under the AuthorAdmin with a different background color, based on

Re: Redundant select on QuerySet delete/update

2009-02-05 Thread George Sakkis
On Feb 5, 3:13 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Thu, Feb 5, 2009 at 3:09 PM, George Sakkis <george.sak...@gmail.com>wrote: > > > > > > > Hello, > > > I am looking at the raw sql executed when I run a delete or update on > >

Redundant select on QuerySet delete/update

2009-02-05 Thread George Sakkis
Hello, I am looking at the raw sql executed when I run a delete or update on a QuerySet and it appears that it does a redundant "select *" for the queryset before the actual delete/update. For example delete_ids = (108, 107, 106) qs = MyModel.objects.filter(pk__in=delete_ids) print

Customize form fields after instantiation

2009-01-24 Thread George Sakkis
Hello all, I'd like an easy way to customize one or more form fields after being instantiated by a ModelForm. I didn't find anything close in the docs so I came up with the following: from django.forms import ModelForm class CustomModelForm(ModelForm): # a mapping of field names to

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 22, 7:04 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Mon, 2008-12-22 at 09:42 -0800, George Sakkis wrote: > > [...] > > > > > Unfortunately it doesn't work for what I tried. What I am trying to do > > is have the Child classes as

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 21, 10:02 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Sun, 2008-12-21 at 18:50 -0800, George Sakkis wrote: > > Hi all, > > > I have a situation which I think would best be modeled as (single) > > inheritance, involving product reviews

Table inheritance and polymorphic admin forms

2008-12-21 Thread George Sakkis
Hi all, I have a situation which I think would best be modeled as (single) inheritance, involving product reviews for various kinds of products. Naturally, there are some fields which are common to all reviews (overall rating, user, review date) and some which are specific to the type of

Adding extra fields in the Admin interface

2007-03-26 Thread George Sakkis
Hi Djangonauts, I read chapters 6 and 18 of the django book about the admin interface and how to extend/customize it but I'm still at a loss on if and how can I add custom fields in the add/change form. What I want to be able to do is set in my model's Admin class extra fields that do not

Re: Property fields

2006-05-13 Thread George Sakkis
George Sakkis wrote: > After digging a little into Django's guts, I came up with a simple > field that is also a property: > > from django.db.models import Field > > class PropertyField(Field,property): > def __init__(self, func, **kwds): > Fi

Re: Property fields

2006-05-13 Thread George Sakkis
Malcolm Tredinnick wrote: > On Sat, 2006-05-13 at 01:33 +0000, George Sakkis wrote: > > Is there a way to combine python properties with Django fields so that > > one can essentially use both regular (persistent) and callable fields > > transparently ? If the previous sen

Property fields

2006-05-12 Thread George Sakkis
Is there a way to combine python properties with Django fields so that one can essentially use both regular (persistent) and callable fields transparently ? If the previous sentence didn't make any sense, here's a simplest example: from django.db.models import Model, IntegerField class

Re: Decoupling fields from forms

2006-05-10 Thread George Sakkis
> I understand that Django maintains two parallel hierarchies of field > classes, one related to models that correspond to table columns and one > that maps these fields to forms so that they can be edited in the admin > interface. This works ok most of the time, but what if one wants to > have

Time delta problem

2006-05-08 Thread George Sakkis
I posted this in MySQLdb's tracker but it seems it has to do with Django. I have a view with one field being a time difference, computed as sec_to_time(unix_timestamp(end)-unix_timestamp(start)). MySQL specifies that the return type is TIME, whose values may range from '-838:59:59' to '838:59:59'

Decoupling fields from forms

2006-04-28 Thread George Sakkis
Hi all, I understand that Django maintains two parallel hierarchies of field classes, one related to models that correspond to table columns and one that maps these fields to forms so that they can be edited in the admin interface. This works ok most of the time, but what if one wants to have an

Decoupling "choices" from Fields

2006-04-16 Thread George Sakkis
Is there any thought on decoupling the "choices" parameter from the type of bound Field, so that for instance something like IntegerField('Results per page', choices=[(n,n) for n in 10,20,30,50,100]) would work as expected and not return string instead ? If not, I'll add a ticket, though I'm

Re: Database views

2006-04-11 Thread George Sakkis
Thank you both for your answer. What I had in mind was read-only views, so all the update limitations are not a problem at all. Also, I am less interested in wrappers over native DBMS views. What I'd like is a programmer-friendly API for views, transparent to the underlying DBMS, similar to how

Foreign key field name confusion (bug ?)

2006-04-09 Thread George Sakkis
Hello, I wonder if there's a bug when saving foreign keys through a manipulator. Check the following lines: # convert the request data into the appropriate Python types for those fields manipulator.do_html2python(new_data) # save the new object manipulator.save(new_data) do_html2python calls

Ordering bugs

2006-03-19 Thread George Sakkis
I'm working on the magic-removal branch and I stumbled on two bugs on ordering: - 'order_with_respect_to' raises OperationalError "no such column: myapp_article._order" - 'ordering' ignores all fields but the first. Can anyone else verify these ? George

Web framework frustration

2006-03-18 Thread George Sakkis
I understand that this is going to be more of a rant than an objective analysis, but after wasting a whole day reading the docs and digging into magic (even in the magic-removal branch) largely undocumented code, I still haven't got the fancy calendar and time javascript admin widgets working in