Table not found error when ordering by foreign key

2006-03-12 Thread jtm
Here is a simplified version of what I am trying to do: App X: class A: shortname = meta.CharField(maxlength=6) App Y: class B: the_A = meta.ForeignKey(A) Y.views: blist = bs.get_list(order_by=['as.shortname']) But Django is telling me that there is no table named 'as'. Everything

Re: Question about _pre_save

2006-03-12 Thread Adrian Holovaty
On 3/12/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > Although the docs say that _pre_save "is called just before an object > is saved to the database", that's not quite correct. _pre_save is > called long before the db is committed, and BEFORE the AutoField "id" > is set meaning that when

Re: import calendar

2006-03-12 Thread Adrian Holovaty
On 3/12/06, Brendon Kelly <[EMAIL PROTECTED]> wrote: > > I guess there maybe a same named file calendar.py or calendar package > > in your directory, which is duplicated with python calendar.py module > > file. > > Ahh... that would be the app I created in my project called calendar :) You > can

Re: Django filter hack

2006-03-12 Thread Adrian Holovaty
On 3/8/06, Andu <[EMAIL PROTECTED]> wrote: > One of the problems I faced when using Django's admin was the filter > part overlapped the table with data, when I showed lots of fields in > the admin listing. > > I did a quick hack today and made it toggable. If you want to aply a > filter, show it.

Re: using context_instance=DjangoContext(request) in generic view url.

2006-03-12 Thread coulix
hum to reformulate simpler, how can i tell in url.py to use generic.simple, and a extra_context which will replace context_instance=DjangoContext(request) i was using in my view method. def faq(request): return render_to_response('faq', {'section':'faq'},

Re: import calendar

2006-03-12 Thread limodou
On 3/13/06, Brendon Kelly <[EMAIL PROTECTED]> wrote: > > > > > I guess there maybe a same named file calendar.py or calendar package > > in your directory, which is duplicated with python calendar.py module > > file. > > > > > > Ahh... that would be the app I created in my project called calendar

Re: import calendar

2006-03-12 Thread Brendon Kelly
I guess there maybe a same named file calendar.py or calendar packagein your directory, which is duplicated with python calendar.py modulefile.Ahh... that would be the app I created in my project called calendar :)  You can tell I'm new to Python (and Django)Thanks for the quick reply.

import calendar

2006-03-12 Thread [EMAIL PROTECTED]
I'm having trouble using the python calendar module in Django. If I type: >>> import calendar >>> print calendar.monthcalendar(2006, 3) at the python shell (not the shell in Django) it works as advertised, but if I type the same code through python manage.py shell, I get: Traceback (most

Re: Changing filenames on an upload...

2006-03-12 Thread tonemcd
Ahhh... Should have said I was using magic-removal, and that this is within the admin interface. The reason for the uuid filename is because I'm thinking of having a lot of files uploaded and I could end up with dozens of files called 'TEST.DOC' and this is one way of guaranteeing that the

Question about _pre_save

2006-03-12 Thread Glenn Tenney
I had wanted to make up a unique field combining some other field and, ideally, an autoincrementing number unique to this class... I'd love to make this the primarykey, but I can't make up a SlugField as the primary key and another field to be the autoincrementing number because AutoField is

Re: subclass calling parent's _pre_save?

2006-03-12 Thread Malcolm Tredinnick
On Sun, 2006-03-12 at 14:46 -0800, Glenn Tenney wrote: > I found that a subclass' _pre_save method superceeds it's parent's > and I have a situation where I need it to do something in addition > to what it's parent does. > > e.g. > > class One(model): > def _pre_save: ...something...

subclass calling parent's _pre_save?

2006-03-12 Thread Glenn Tenney
I found that a subclass' _pre_save method superceeds it's parent's and I have a situation where I need it to do something in addition to what it's parent does. e.g. class One(model): def _pre_save: ...something... class Two(One): def _pre_save: ? Based on Python

Re: is it worth waiting to the 1.0 release?

2006-03-12 Thread James Bennett
On 3/12/06, MarC <[EMAIL PROTECTED]> wrote: > Is "svn co http://code.djangoproject.com/svn/django/trunk/; close enough to > the final 1.0 version > and safe/stable enough? It's safe enough for use, but the next version, 0.92, is going to make a huge number of backwards-incompatible changes. My

Re: is it worth waiting to the 1.0 release?

2006-03-12 Thread Ivan Sagalaev
MarC wrote: >hi, >this is a general question, >I'm planning to use django for a personal-maybe_someday_big database based >project. I saw that >version 1.0 has not been released yet, but sbdy warned me that many things are >changing. >This plus the "Note that, until 1.0, there is no guarantee

Re: is it worth waiting to the 1.0 release?

2006-03-12 Thread Don Arbow
I have just started in with Django development and the warnings about the upcoming 1.0 release (and 0.92, for that matter) don't scare me at all. The current code works well and you may not ever have to upgrade if you don't feel the need to. A lot of the coming changes are for cleaning up

Re: Django Website Running well, MySQL Connectivity Keeps going away

2006-03-12 Thread [EMAIL PROTECTED]
I see that this is related to using Django with FastCGI and MySQL. Is there anything that is pertinient to using Django and MySQL with mod_python? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

is it worth waiting to the 1.0 release?

2006-03-12 Thread MarC
hi, this is a general question, I'm planning to use django for a personal-maybe_someday_big database based project. I saw that version 1.0 has not been released yet, but sbdy warned me that many things are changing. This plus the "Note that, until 1.0, there is no guarantee of

save() and null/blank character fields

2006-03-12 Thread Zanchey
Hi all, After tearing my hair out with an "OperationalError: Unable to close due to unfinalised statements" exception this afternoon under SQLite, I switched over to Postgres. This threw more helpful exceptions, and led me to discover that when calling save() on an AddManipulator instance, any

How to enter all model-related data on one form?

2006-03-12 Thread Mike Kent
I want to create a form for entering data and all of its related data, on one form. Here's a simplified model to illustrate: class Author(meta.Model): name = meta.CharField(maxlength=40) class Book(meta.Model): title = meta.CharField(maxlength=40) authors =

Re: Template formatting (e.g. HTMLtidy) ?

2006-03-12 Thread akaihola
I found this discussion concerning HTML Tidy and ASP.NET tags: http://blogs.borland.com/stevet/archive/2004/10/11/1568.aspx Another idea: Write a wrapper for HTML Tidy to convert Django tags/vars to HTML comments and back. It would be a serious hack, but could work: {% tagname parameters %} =>

Re: Template question

2006-03-12 Thread Rob Slotboom
Hi Malcolm, {{forloop.counter|add:offset}} works fine. Thanks, Rob --~--~-~--~~~---~--~~ 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

Re: Template formatting (e.g. HTMLtidy) ?

2006-03-12 Thread akaihola
For Emacs users: Emacs' nxml-mode seems to work rather well with Django templates. It underlines tags and variable references with a red line, but otherwise it's nice to work with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: basic model with user foreign key.

2006-03-12 Thread akaihola
from django.models.auth import User --~--~-~--~~~---~--~~ 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

Re: basic model with user foreign key.

2006-03-12 Thread patrick k
e.g. from django.models import auth owner = meta.ForeignKey(auth.User) ... that works for me. > > from django.core import meta > from django.models.auth import users ??? > > class Recette(meta.Model): > slug = meta.SlugField("Slug", prepopulate_from=('nom',) ,unique=True, > blank=True) > nom

basic model with user foreign key.

2006-03-12 Thread coulix
from django.core import meta from django.models.auth import users ??? class Recette(meta.Model): slug = meta.SlugField("Slug", prepopulate_from=('nom',) ,unique=True, blank=True) nom = meta.CharField(maxlength=80,help_text=_('Nom de la recette'), unique=True) []

Changing filenames on an upload...

2006-03-12 Thread tonemcd
Hi all, I have this model class Photo(models.Model): name = models.CharField(maxlength=20) image = models.ImageField(upload_to="cetl/") def save(self): import commands self.image = 'cetl/%s' % commands.getoutput("uuidgen") super(Photo, self).save() def

Model Subclassing and some questions

2006-03-12 Thread Panos Laganakos
Hello, I am defining a Product class that gets inherited by various products, so I am defining in it all the base attributes that exist on all child products. I want to know if its possible to forbid changing the actual "products" table unless you add one of the actual child products. Also,

Template formatting (e.g. HTMLtidy) ?

2006-03-12 Thread [EMAIL PROTECTED]
Hi. Can anybody recommend a good tool (or PyDev/Eclipse plugin) for formatting template files? HTMLTidy with its default settings just doesn't cut it -- it insists on inserting HTML and body tags around the template and screwing up the template statements. Or maybe someone has a good working