Question about ForeignKeys and subclasses

2009-05-31 Thread Rex
Hello, I have a question that is best illustrated by the following fictional example. (I put my question at the end.) #= # In models.py class Room(models.Model): animal = models.ForeignKey(Animal) class Animal(models.Model): #[...] class Duck(Animal): #[...] # In views.py

Re: comma seperated lists

2009-05-31 Thread Brian May
On Fri, May 29, 2009 at 01:50:38AM -0700, V wrote: > if you do this to get a comma separated list you might like > https://launchpad.net/django-export-csv No, I don't use CSV here, but it is nice to know such a facility exists - I have used CSV for other projects. Thanks. -- Brian May

Re: comma seperated lists

2009-05-31 Thread Brian May
On Fri, May 29, 2009 at 02:03:59AM -0700, Daniel Roseman wrote: > Alternatively, you could use the join filter: > > {{ object.photoperson_set.all|join:", " }} I considered that, however, I don't think I can set the tag for every person, and the result would be I cna't click on the items in

Re: filtering on reverse foreignkey using isnull

2009-05-31 Thread Eric Abrahamsen
On May 31, 2009, at 11:45 PM, Karen Tracey wrote: > On Sun, May 31, 2009 at 10:13 AM, Eric Abrahamsen > wrote: > > Hi, > > I've got two models, Author and Entry, with a foreignkey from Entry to > Author. There are many Authors with no related entries, and until > recently

images do not upload

2009-05-31 Thread Bobby Roberts
hi all.. using 1.0 w/ py 2.5 here. I have a problem with an ImageField failing to upload the images. i've checked the perms on the dir and they appear to be ok. Here are snippets of what i've got: from models.py pic = models.ImageField(upload_to='public/images/ bank_pics',blank=True)

Newbie Django 1.0 help with create object, uopdate object

2009-05-31 Thread adelaide_mike
I found a really clear explanation of creating and updating database objects in SAMS TeachYourself Django, but it appears to be for v 0.96. I have looked at "Creating forms from models" in the documentation, and about one-third the way down it shows the following: # Create a form instance from

Re: Auth permitions in templates

2009-05-31 Thread Gabriel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Rapis escribió: > Second always set context_instance to RequestContext: > render_to_response("some_template.html", {}, > context_instance=RequestContext(request)) > > Annoying thing, that I can't forget to do it in one way, and also I > have to

Group servers dopping posts?

2009-05-31 Thread Joshua Russo
Are others having problems with posts disappearing? I've posted had a couple of different posts disappear. One was a harmless question about pdb and another was about a set of currency objects I posted to djangosnippets.org and was looking for feedback on.

Re: Auth permitions in templates

2009-05-31 Thread Rapis
Hello, I had similar problem, what I couldn't access user object in templates. Now I have to solutions, and both of them are annoying. First always pass a user to template: render_to_response("some_template.html", {'user':request.user}) Second always set context_instance to RequestContext:

Re: Temporary urls for tests

2009-05-31 Thread Filip Gruszczyński
That's handy. Thanks. W dniu 31 maja 2009 10:23 użytkownik V napisał: > > another possibility is to call the views from your test directly, a > relevant snippet to construct a request objects is > http://www.djangosnippets.org/snippets/963/ > > V > > On May 30, 3:43 pm,

Re: comments error

2009-05-31 Thread lperk
Does someone know how to redirect posted comment to another page if you have your own form for sending comments? On May 31, 9:55 pm, lperk wrote: > Hey.. I'm trying to send comment with django comments option and > everything is ok..I see it form..but when I send comment I

Re: List won't return the requested item

2009-05-31 Thread Karen Tracey
On Sun, May 31, 2009 at 2:36 PM, phildev7...@gmail.com < phildev7...@gmail.com> wrote: > > Hi there, > > I am having a puzzling issue with something that should be pretty > straightforward. I have a variable called "sznames" which results from > a .values() request performed on a queryset. >

comments error

2009-05-31 Thread lperk
Hey.. I'm trying to send comment with django comments option and everything is ok..I see it form..but when I send comment I got error: Comment post not allowed (400) Why:Missing content_type or object_pk field. Can anyone help me with this.. what do I have to do..where to insert

List won't return the requested item

2009-05-31 Thread phildev7...@gmail.com
Hi there, I am having a puzzling issue with something that should be pretty straightforward. I have a variable called "sznames" which results from a .values() request performed on a queryset. This "sznames" variable is successfully filled with dictionaries - three dictionaries in the test I am

Re: Drill down combo boxes (Country, State, City)

2009-05-31 Thread Chris Moffitt
You want a chained select form & will need to use javascript to do it. I prefer jquery and have used the one here - http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/ The code demos are for PHP but it's simple enough to apply to Django. -Chris On Sun, May 31, 2009 at 12:11

Re: question about generic many to many relations

2009-05-31 Thread Mozey
There, i found a better way of doing it!, thanks peopel, On May 31, 11:15 am, Mozey wrote: > Hello people, > > I have a model object "X", which allows other model objects to relate > many to many to it through generic table "Y". Both kept in one app. > > In another app, i

question about generic many to many relations

2009-05-31 Thread Mozey
Hello people, I have a model object "X", which allows other model objects to relate many to many to it through generic table "Y". Both kept in one app. In another app, i have two model objects "J", and "K" who are related to "X" through "Y". The instances of "K" should be a subset of "J". How

Drill down combo boxes (Country, State, City)

2009-05-31 Thread Weiss Blitz
I'm building a website where the user must enter his location information during user registration. I would like to have a combo box for each of the country, state, and city fields. The user will drill down their selections by first selecting their country, then the state combo box should

Re: What's wrong with this code?

2009-05-31 Thread Daniel Roseman
On May 31, 9:56 am, andrew_dunn wrote: > I'm trying to run a script to import data to my model. All the field > names are correct. What I'm getting is an error message that says my > syntax is incorrect on the line that says "for row in reader:" It says > the error is on

Re: filtering on reverse foreignkey using isnull

2009-05-31 Thread Karen Tracey
On Sun, May 31, 2009 at 10:13 AM, Eric Abrahamsen wrote: > > Hi, > > I've got two models, Author and Entry, with a foreignkey from Entry to > Author. There are many Authors with no related entries, and until > recently I've been able to put this manager on the Author model to >

Re: UnicodeDecodeError

2009-05-31 Thread Karen Tracey
On Sun, May 31, 2009 at 6:24 AM, Vlad(L) wrote: > > The second day I fight, I can not troubleshoot. I wish to output in > django blog page, and to me produces UnicodeDecodeError. > I have filled a blog with the Russian text, and was English probably > error would not be.

Re: form adding

2009-05-31 Thread Karen Tracey
On Sun, May 31, 2009 at 3:05 AM, samira wrote: > > Hello all > I am using djnago for 2 years, but I don't see such a problem yet. For > adding data to database, I create a template to display input text, > some of that data is required but when I go to page for first time,

Django and Tuscany Native Sca

2009-05-31 Thread herit...@gmail.com
In my projects, First, i use Tuscany Native Sca and deploy some services into AXIS2/C, then in my Django web srcripts, i use "import sca, sco.locateservice()" to access those services to get functions, but them can be only accessed once, Memory Error! Why?Is Anybody meet this problems? Thanks!

filtering on reverse foreignkey using isnull

2009-05-31 Thread Eric Abrahamsen
Hi, I've got two models, Author and Entry, with a foreignkey from Entry to Author. There are many Authors with no related entries, and until recently I've been able to put this manager on the Author model to only select Authors with Entries: def contributors(): return

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Already got it, it's: timedelta(seconds=1) In stead of: datetime.timedelta(seconds=1) On 31 mei, 14:29, "K.Berkhout" wrote: > Hmm, seems like the method always returns false, anybody knows what > goes wrong? > > On 31 mei, 12:29, "K.Berkhout" wrote: > >

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Hmm, seems like the method always returns false, anybody knows what goes wrong? On 31 mei, 12:29, "K.Berkhout" wrote: > Thanks you very much for the solution, Damien! > > On 30 mei, 22:11, Damien GOMBAULT wrote: > > > Write a method is_modified in your

Re: Cycle tag must be in same template, why? Any options?

2009-05-31 Thread Jari Pennanen
I found the culprit, http://code.djangoproject.com/svn/django/trunk/django/template/defaulttags.py line 507: "if not hasattr(parser, '_namedCycleNodes'):" Parser is template specific, but making cycle not work is stupid since I noticed something else too, the variable *is* passed to

Re: Need help

2009-05-31 Thread Tim Chase
mizan rahman wrote: > No, i've checked that i've created a user named "djangouser" and the > problem still exist what will i do? Plz help me and you've checked that the password in settings.py is correct? You only confirmed one of the two problems I suggested. If both are correct, you may have

Cycle tag must be in same template, why? Any options?

2009-05-31 Thread Jari Pennanen
Hi! Is there reason why cycle must be in the *same* template, and not for instance in parent template? There are usecases: list.html: {% cycle 'row1' 'row2' as rowcolors %} .. .. .. {% for item in object_list %} {% include "list_item.html" %} {% endfor %} list_item.html: .. ..

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Thanks you very much for the solution, Damien! On 30 mei, 22:11, Damien GOMBAULT wrote: > Write a method is_modified in your Post model. > You can use datetime.timedelta to compare dates. > > def is_modified(self): >    second = datetime.timedelta(seconds=1) >    delta =

UnicodeDecodeError

2009-05-31 Thread Vlad(L)
The second day I fight, I can not troubleshoot. I wish to output in django blog page, and to me produces UnicodeDecodeError. I have filled a blog with the Russian text, and was English probably error would not be. Here an error code: Environment: Request Method: GET Request URL:

Re: Need help

2009-05-31 Thread Skylar Saveland
sky...@abc255:/$ sudo updatedb [sudo] password for skylar: sky...@abc255:/$ locate pg_hba.conf /etc/postgresql/8.3/main/pg_hba.conf sky...@abc255:/$ sudo vim /etc/postgresql/8.3/main/pg_hba.conf There should be some lines something like this (for local access): local all postgres

Re: What's wrong with this code?

2009-05-31 Thread Skylar Saveland
It looks pretty good to me. Are you trying this in a shell? If not that might help you debug. You are missing a ')' at the end of >>>reader = csv.reader(open("mysite\restaurants.csv") that is probably actually your problem ;-). I was experiencing some strange behavior as I was playing with

What's wrong with this code?

2009-05-31 Thread andrew_dunn
I'm trying to run a script to import data to my model. All the field names are correct. What I'm getting is an error message that says my syntax is incorrect on the line that says "for row in reader:" It says the error is on the colon. If I remove the colon, it gives a syntax error on the last

Re: Need help

2009-05-31 Thread mizan rahman
No, i've checked that i've created a user named "djangouser" and the problem still exist what will i do? Plz help me Regards, Mizan On 5/29/09, Tim Chase wrote: > >> File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ >>

Re: Temporary urls for tests

2009-05-31 Thread V
another possibility is to call the views from your test directly, a relevant snippet to construct a request objects is http://www.djangosnippets.org/snippets/963/ V On May 30, 3:43 pm, Ramiro Morales wrote: > 2009/5/30 Filip Gruszczyński : > > > > > I am

Middleware Authentication and 'get_and_delete_messages'

2009-05-31 Thread sahid
Hello, i use a native django in appengine i have create a authentication middleware in django,. I am inspired by contrib {{{ class LazyUser (object): def __get__ (self, request, obj_type = None): if not hasattr (request, '_cached_user'): from common import user

form adding

2009-05-31 Thread samira
Hello all I am using djnago for 2 years, but I don't see such a problem yet. For adding data to database, I create a template to display input text, some of that data is required but when I go to page for first time, before clicking save button I see the required error and it seems for loading

Re: How to use next with comments?

2009-05-31 Thread Eric Abrahamsen
On May 29, 2009, at 5:40 AM, Kevin Fullerton wrote: > > > On Thu, May 28, 2009 14:31, Eric Abrahamsen wrote: >> >> The default comment form does not include a next parameter, so if you >> don't override the builtin comment templates you won't get any next >> parameters in the forms. The most

Re: forms / confirmation

2009-05-31 Thread V
I think not using a form in itself is not a problem, it's more a way of organising your code which would let you add all the user interaction in forms. And actually, you could still do it even without a POST method. You have request.GET or request.REQUEST to store the passed variables. To get