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 wrote: > On Thu, Jul 15, 2010 at 11:02 AM, George Sakkis > wrote: > > On Jul 15, 4:55 am, Danny Adair wrote: > > >> Hi, > > >> I had the exact same problem, and I had _not_ installed Weave. > >> The offending confi

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 > Firefox 3.6.6 > > I can r

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. > > Glad I could help :) > > I'm using Weave t

Re: break/continue for templates

2010-07-05 Thread George Sakkis
On Jul 5, 2:25 pm, Torsten Bronger 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 put it in the > > view" argumen

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. However, I've never come across

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 syntact

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 when I use Firefox under Ub

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 are dynamically crea

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 co

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 t

Re: Redundant select on QuerySet delete/update

2009-02-05 Thread George Sakkis
On Feb 5, 3:13 pm, Alex Gaynor wrote: > On Thu, Feb 5, 2009 at 3:09 PM, George Sakkis wrote: > > > > > > > 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 "sele

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 connection.qu

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 attr./va

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 22, 7:04 pm, Malcolm Tredinnick 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 InlineModelAdmin in some o

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 21, 10:02 pm, Malcolm Tredinnick 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 for various kinds of products. >

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 product.

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 corresp

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): >

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

Re: Dilemma: code duplication or complexity?

2006-05-12 Thread George Sakkis
> Hi, > > I'm working on a ticket management system (a la Trac) > for in-house applications for my company. I stopped reading here... why reinvent the (trac)wheel ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

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 Foo(Model

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 an

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 not

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 Mo

Database views

2006-04-09 Thread George Sakkis
I understand Django doesn't support database views (http://en.wikipedia.org/wiki/View_%28database%29) right out of the box, but I was wondering if there's a reasonably easy way to implement (or at least emulate) them. Here's an illustration of a possible API (compatible to the magic-removal DB API

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 Fo

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 m