Re: Confusion about templates directory location

2006-03-19 Thread Luke Skibinski Holt
> you need to restart the server to find them. the development server? fcgi? apache? I've found I've never needed to restart a server in order to discover new templates - even with dreamhost + fcgi ;) my dir structure looks like: /projectname /src /media /docs /templates I've fo

intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread coulix
Hello, here is my model class Mark(meta.Model): recipe = meta.ForeignKey(Recipe) user = meta.ForeignKey(User, unique=True) mark = meta.SmallIntegerField() def __repr__(self): return "%s" % (self.get_recipe(), self.get_user(), mark) i want a user to be alble to mark a r

Re: intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread akaihola
To complete your model, I think a unique_together='recipe','user' should be added. What happens if you have unique_together='recipe','user' and try to create a Mark which already exists? --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread coulix
well i wish the mark would be updated on the same row. any idea how to achieve this ? appart from check / erase /add --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: ProgrammingError ... after adding new field to my model ...

2006-03-19 Thread ZebZiggle
Good point. Sadly, I'm not constructing the SQL, Django is. It could very well be that postgres is mangling the value string (thinking it's a column) ... that would possibly also explain why the exception message is truncated. I was looking at the django code last night and can't see anything obvi

Re: intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread coulix
That how i did it finally, MODEL class Mark(meta.Model): recipe = meta.ForeignKey(Recipe) user = meta.ForeignKey(User, unique=True) mark = meta.SmallIntegerField() def __repr__(self): return "%s from %s, mark = %s " % (self.get_recipe(), self.get_

Re: intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread Julio Nobrega
Does Postgresql and sqlite support REPLACE INTO? Django could add that... But anyway, the .save() method updates the row. So just .get_object() it first and run .save(). I think :p On 3/19/06, coulix <[EMAIL PROTECTED]> wrote: > > well i wish the mark would be updated on the same row. > any

Re: Recursive ForeignKey with blank=True

2006-03-19 Thread tonemcd
This works for me David, class Staff(models.Model): name = models.CharField(maxlength=50) reportsTo = models.ForeignKey("self", blank=True, null=True) def __repr__(self): return "%s" % self.name class Admin: list_display = ('name',) This is with the magic-remova

Problem with _post_save() and _pre_save() for model with ImageField

2006-03-19 Thread katamari
I'm struggling with getting _pre_save() or _post_save() to work. I will have prose description followed by code. What I'm Using == Trunk version of Django 0.91.x What I'm Trying To Do = There are multiple images associated with a master asset. Each image has a pre

Re: Joining foreign keys backwards?

2006-03-19 Thread Adrian Holovaty
On 3/18/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: > I want to select objects based on their relationships with related > objects, but I don't seem to be able to do it, because I'm trying to use > a foreign key in the "wrong" direction. For example, in the Polls and > Choices model, I can do t

Re: Joining foreign keys backwards?

2006-03-19 Thread Adrian Holovaty
On 3/19/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > Here's how I'd solve this particular problem: > > [c.get_poll() for c in choices.get_list(choice__exact='foo')] > > If you need to remove duplicates: > > dict([(c.get_poll(), 1) for c in > choices.get_list(choice__exact='foo')]).keys

OneToOneField

2006-03-19 Thread layik
is the bug fixed? I didnt quite understand the previous topics. could anyone please tel me what I need to be aware of when trying to extend tables and using OneToOneField many thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

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 --~--~-~--~~~--

Re: ProgrammingError ... after adding new field to my model ...

2006-03-19 Thread ZebZiggle
SOLVED! The text I was using for the value was unicode. This resulted in the string not being quoted when the SQL was being fabricated. For now, I did a u"My Unicode String".encode('ascii') and it works fine. Cheers, Zeb --~--~-~--~~~---~--~~ You received this

Adding additional logging to Django application

2006-03-19 Thread [EMAIL PROTECTED]
I've been adding additional logging to my django application by dropping in calls in the views.py. However, I'm concerned that I've really overdoing it with setting up a new logging instance on each call. Right now, I've have the following code in each view that wants to log: ll=logging.getL

Solved: Table not found error when ordering by foreign key

2006-03-19 Thread jtm
My original question (http://groups.google.com/group/django-users/browse_frm/thread/1581881fb9c1ddc1/#): 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_li

Re: transactions ?

2006-03-19 Thread Russell Keith-Magee
On 3/19/06, Julien Cigar <[EMAIL PROTECTED]> wrote: Hello,I just discovered Django a few days ago and wondered if it's possible toenclose multiple .save() in one transaction ?Hi Julien,Support for transactions is one of the features that has been added to the magic-removal development stream of Dja

Re: Adding additional logging to Django application

2006-03-19 Thread Ned Batchelder
This is the sort of thing that can be done at the top level of the module, so it is executed once per process, rather than once per request. --Ned. [EMAIL PROTECTED] wrote: > I've been adding additional logging to my django application by > dropping in calls in the views.py. However, I'm concer

Re: django problem at dreamhost

2006-03-19 Thread Jaanus
This "no module named apps" is driving me nuts. Anyone, please help. I took the settings from my Windows laptop where it worked, and am trying to install in a Linux host. Here's the dump of "sqlreset", so this happens even before I ever get around to getting anything to run on the server. The Djan

Re: django problem at dreamhost

2006-03-19 Thread Jaanus
hmm.. and just as I wrote this, I noticed the Django demo page on that Linux host says... "Start your first app by running trmproject/manage.py startapp [appname]." After I did it, the new app showed up right in the project's directory, without "apps". So in one host it is with "apps" and in ano

Re: django problem at dreamhost

2006-03-19 Thread James Bennett
On 3/19/06, Jaanus <[EMAIL PROTECTED]> wrote: > After I did it, the new app showed up right in the project's directory, > without "apps". So in one host it is with "apps" and in another it's > not. What's the logic behind that? At least I got it to work for myself > but would be good to know... T

Re: django problem at dreamhost

2006-03-19 Thread limodou
On 3/20/06, Jaanus <[EMAIL PROTECTED]> wrote: > > hmm.. and just as I wrote this, I noticed the Django demo page on that > Linux host says... > > "Start your first app by running trmproject/manage.py startapp > [appname]." > > After I did it, the new app showed up right in the project's directory,

Re: django problem at dreamhost

2006-03-19 Thread Vladimir Tarasov
$ cd myapp $ python manage.py sqlreset appname --~--~-~--~~~---~--~~ 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,

Re: ProgrammingError ... after adding new field to my model ...

2006-03-19 Thread Kenneth Gonsalves
On Monday 20 Mar 2006 2:54 am, ZebZiggle wrote: > For now, I did a u"My Unicode String".encode('ascii') and it > works fine. good to know - am planning a project with lots and lots of utf8 stuff, so can avoid this error -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://av

Re: Adding additional logging to Django application

2006-03-19 Thread [EMAIL PROTECTED]
Thanks ned - just what I needed! --~--~-~--~~~---~--~~ 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 email to

Re: LIKE operator

2006-03-19 Thread PythonistL
Ivan, Thank you for your reply and help L. --~--~-~--~~~---~--~~ 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, sen