Updating instances of related models

2006-11-10 Thread Spiller
Hello everyone. I've been spending some time with django and I must admit I find it very intuitive. Hat off to the devs. What I'm trying to do is write a small survey app. It has these three basic models: ---

Re: template tags to filter rows

2006-11-10 Thread Russell Keith-Magee
On 11/10/06, Picio <[EMAIL PROTECTED]> wrote: > > Hello, > I'm searching for ways to filter query_set inside the admin interface, > without hacking It. Do you think is It possible through so template > tags? Well.. yes, but it's the wrong way to solve the problem. You _could_ write a template tag

Re: Add to Favourites type feature?

2006-11-10 Thread Russell Keith-Magee
On 11/10/06, Jamie Pittock <[EMAIL PROTECTED]> wrote: > > I'm learning Django and Python as I go. A long shot but does anyone > know of some site code that's been released with some kind of "add to > favorites" feature? I know, it's cheating but I learn much quicker > from examples. This isn't

Re: How much do you cost?

2006-11-10 Thread Kenneth Gonsalves
On 11-Nov-06, at 3:23 AM, [EMAIL PROTECTED] wrote: > 1). A system for publishing our newspaper content, > including a > comment system that would allow registered users to respond to > articles. 5 man hours > 2). A blog, with the same comment system. (We'd start with > one

newbie startup question about ImportError on Windows with Apache/mod_python

2006-11-10 Thread benstewart
I'm on Windows XP, Python 2.4, Apache 2.0, Subversion, mod_python, MySQL, PostgreSQL (just in case), etc... My project is named "mydjango" (instead of mysite in the tutorial). I can see the lovely Django welcome screen in my browser, so Python, mod_python, and Django should be working properly.

How much do you cost?

2006-11-10 Thread [EMAIL PROTECTED]
Hi there. I hope this isn't a completely off-the-wall question. I'm the editor of a small alt-weekly newspaper with a hideous web site. We want to re-do it in Django, to snap up the presentation and also add some new features that will move us at least slightly into the 21st century.

Re: POST Behavior

2006-11-10 Thread Joseph Heck
I won't claim anything about "right" - but a potential:Consider assigning an "Id" to the print request and then redirecting to the a url that uses that "Id" as an input to print out a PDF. i.e. upon post, an ID gets requested and created - say "39" for the sake of argument. Then redirect to /myapp/

Re: Trac/Django on the same Apache instance

2006-11-10 Thread Antonio Cavedoni
On 10 Nov 2006, at 15:04, Rachel Willmer wrote: > I have trac/django co-existing happily with the following config: > > They both run on separate virtual hosts under Apache2. I have the same configuration (different Virtual Hosts, same Apache). I dug some more, and apparently it’s the datatype o

Re: Retreiveing a QSet from a Parent Table

2006-11-10 Thread Zak Johnson
Merric Mercer wrote: > Can anybody recommend an elegant way to achieve point this. I can > retrieve the qs with all the related brand records but I cannot work > out how to retrieve the query set whilst omitting the related initial > record. > > Currently I have. > > 1. qs=Child.objects.get

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
Very helpful and instructive. Thanks. MerMer Jay Parlar wrote: > On 11/10/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > >> On 11/10/06, Merric Mercer <[EMAIL PROTECTED]> wrote: >> >>> Jay, that works! Many thanks. Though I don't quite understand why - or >>> where 'values' come from.

POST Behavior

2006-11-10 Thread David S .
I am looking for advice on best practices. I have an intranet application running (on Django) for which there is a process that POSTs a request to print checks. It is a POST because it creates entries in the checks table but the result is a PDF file that the user can then print. But, because I

Re: Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Jay Parlar
On 11/10/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 11/10/06, Merric Mercer <[EMAIL PROTECTED]> wrote: > > > > Jay, that works! Many thanks. Though I don't quite understand why - or > > where 'values' come from. Could you explain. > > .values is a standard method on dictionary objects w

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Jeremy Dunck
On 11/10/06, Merric Mercer <[EMAIL PROTECTED]> wrote: > > Jay, that works! Many thanks. Though I don't quite understand why - or > where 'values' come from. Could you explain. .values is a standard method on dictionary objects which returns a list containing the values in the dictionary in an

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
Jay, that works! Many thanks. Though I don't quite understand why - or where 'values' come from. Could you explain. MerMer > > {% for item in campaigns.values %} > {{item.id}} > {% endfor %} > > > > > > --~--~-~--~~~---~--~~ You received this message beca

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
Jay, Many thanks for this. As a recent newbie to Django and Python could you give me a steer what I would need to do to make this tag. (I familiar with making tags and filters, but can't see how I can use a tag to solve this problem.) MerMer Jay Parlar wrote: > On 11/10/06, Jay Parlar <[EMA

Re: moving django applications

2006-11-10 Thread Guillermo Fernandez Castellanos
Sorry, I did not get you... What I do in those cases is indeed put a variable in the settings.py, and a default value in the models.py of each app: try: myvar=settings.myvar except: myvar=default_value I then use the variable in the model to construct the get_absolute_url function. You

Re: Re: Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Jay Parlar
On 11/10/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > When you iterate over a dictionary, you're iterating over the *keys* > in the dictionary, not the values. > > ie. > > In [1]: x = {"a":1, "b":2} > > In [2]: for each in x: >...: print each >...: >...: > a > b > > According to a c

Re: Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Jay Parlar
On 11/10/06, Merric Mercer <[EMAIL PROTECTED]> wrote: > > Kamil, many thanks but your suggestion does not work. I should have > mentioned that I had already tried that. > > I am returning a dictionary nested inside the main dictionary like so:- > > return render_to_response ('myapp/detail.html',

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
Kamil, many thanks but your suggestion does not work. I should have mentioned that I had already tried that. I am returning a dictionary nested inside the main dictionary like so:- return render_to_response ('myapp/detail.html', { 'key1': value1, 'key2': value2, 'campaigns':dict1}), so I pres

Re: moving django applications

2006-11-10 Thread Sandro Dentella
On Fri, Nov 10, 2006 at 05:43:28PM +0100, Guillermo Fernandez Castellanos wrote: > > Hi, > > Maybe this will help you: > http://www.djangoproject.com/documentation/sites/ if I understant it correctly this has nothing to do with what I want. They have different domain, I want a single domain. Th

My own auth backend

2006-11-10 Thread Grigory Fateyev
Hello! Try to write my own backend authenticate function, but users from anothe table can not login. What can it be? Any suggestions? My code is: # anastas/settings.py: AUTHENTICATION_BACKENDS = ( 'anastas.apps.accounts.backend.MyAuthBackend', 'django.contrib.auth.backends.ModelB

Re: moving django applications

2006-11-10 Thread Guillermo Fernandez Castellanos
Hi, Maybe this will help you: http://www.djangoproject.com/documentation/sites/ G On 11/10/06, sandro.dentella <[EMAIL PROTECTED]> wrote: > > hi all, > > how should I organize my configuration so that it's easy to have > several django applications in the same apache (not as virtual > domains

Re: How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Kamil Wdowicz
{% for item in campaigns %} {{ item.id }} {% endfor %} 2006/11/10, Merric Mercer <[EMAIL PROTECTED]>: > > As part of my render_to_response I have returned the following:- > 'campaigns':dict1 - where dict1 is a dictionary of objects from a model > called "Campaigns". > > In my template I can d

moving django applications

2006-11-10 Thread sandro.dentella
hi all, how should I organize my configuration so that it's easy to have several django applications in the same apache (not as virtual domains!) and to move them from one position to another. I managed to configur apache to have several different django applications but I need to change the

Retrieving a QSet from a Parent Table.

2006-11-10 Thread MerMer
Starting with specific record in a child table want to do the following. 1. Access a related field 'Brand Name' in the parent table. 2. Retrieve a query set of records in the Parent table that match the Brand name. BUT I want't to exclude the intial record I started with. Can anybody recom

Add to Favourites type feature?

2006-11-10 Thread Jamie Pittock
Morning all, I'm learning Django and Python as I go. A long shot but does anyone know of some site code that's been released with some kind of "add to favorites" feature? I know, it's cheating but I learn much quicker from examples. Or alternatively any relevant resources that might help? Any

template tags to filter rows

2006-11-10 Thread Picio
Hello, I'm searching for ways to filter query_set inside the admin interface, without hacking It. Do you think is It possible through so template tags? Is there any article example you can point me out? Thanks. Picio --~--~-~--~~~---~--~~ You received this messag

Re: sqlite3 "database locked"

2006-11-10 Thread Rachel Willmer
Following up on my own question, it looks to me like implementing a new default Manager class is the way to go. Anyone got a better solution? Rachel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gr

sqlite3 "database locked"

2006-11-10 Thread Rachel Willmer
I'm using a sqlite3 database as the backend for a Django app and frequently get "OperationalError: database locked". Is there a way of specifying a timeout handler within Django in the same way that you can using the C library version of sqlite3? Rachel --~--~-~--~~~

How do you iterate over a dictionary of objects within a template?

2006-11-10 Thread Merric Mercer
As part of my render_to_response I have returned the following:- 'campaigns':dict1 - where dict1 is a dictionary of objects from a model called "Campaigns". In my template I can do things like {{ campaigns.0.id }} and {{ campaigns.1.id }} to access the dictionary. But, how do I iterate over

Re: Trac/Django on the same Apache instance

2006-11-10 Thread Rachel Willmer
I have trac/django co-existing happily with the following config: They both run on separate virtual hosts under Apache2. The trac config looks like this: SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv

Re: User/request.user confusion

2006-11-10 Thread [EMAIL PROTECTED]
Shoulda mentioned that... I've got NO caching on. I did have it on, but turned it off when I ran into similar issues, until I can remember to look into view-by-view caching. Anyways, no caching. And they ARE logged in as the other person, complete with all rights that person has. Scary. --~--~

Re: Paginator question

2006-11-10 Thread Pythoni
Thank you for your reply. I downloaded the 0.95 version and It works under 0.91 Regards, 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@g

Ordering by str

2006-11-10 Thread Jamie Pittock
I'm refering again to using this code from the cookbook: http://code.djangoproject.com/wiki/CookBookCategoryDataModelPostMagic My entry class has an 'assoc_cats' field (assoc_cats = models.ManyToManyField(Category)). How can I order the categories to match the __str__ (Home :: Garden) rather th

Trac/Django on the same Apache instance

2006-11-10 Thread Antonio Cavedoni
Hello django-users, I’m having a bit of a problem making Trac and Django coexist on the same Apache instance. I have django.example.org and trac.example.org, both with their own PythonInterpreter directive set to “django” in the former case and “trac” in the other. The problem is that if

Re: Re: Models as a Package

2006-11-10 Thread Nathan Yergler
On Thu, 2006-11-09 at 15:49 -0600, James Bennett wrote: > On 11/9/06, Nathan Yergler <[EMAIL PROTECTED]> wrote: > >class Meta: > > app_label = 'app_name' > > Yeah, that's a huge wart that comes out of the way the metasystem > works right now. Anybody got ideas for something better? >

Re: Debugging with Winpdb

2006-11-10 Thread Baurzhan Ismagulov
Hello Mike, On Fri, Nov 10, 2006 at 11:30:03AM -, Mike wrote: > Anybody debugging Django apps successfully with Winpdb? pdb worked for me, can't say anything about pdb. With kind regards, Baurzhan. --~--~-~--~~~---~--~~ You received this message because you

Re: Django, RDF & XUL

2006-11-10 Thread Bill de hOra
benj wrote: > Hi folks, > After using django for a number of more conventional projects, I'm > toying around with trying to use it to drive a XUL application. Using > django's template system to generate XUL views is easy enough, as is > passing serialized objects around with AJAX. However, most o

Retreiveing a QSet from a Parent Table

2006-11-10 Thread Merric Mercer
Starting with specific record in a child table I need to do the the following. 1. Access a related field 'Brand Name' in the parent table. ( No problem) 2. Retrieve a query set of records in the Parent table that match the 'Brand Name'. (No Problem) BUT I want to exclude the initial reco

Re: Debugging with Winpdb

2006-11-10 Thread Mike
Anybody debugging Django apps successfully with Winpdb? --~--~-~--~~~---~--~~ 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 t

Re: mod_python + sqlite3 does not work

2006-11-10 Thread [EMAIL PROTECTED]
Hi! I have downgraded my pysqlite version from 2.3.1 (or 2.3.2, I tried first this upgrade, but with same errors like in 2.3.1) to 2.0.7, and it worked again. My trac installations behave similar, so I think it is a problem with the newer pysqlite versions. Best regards, Ralf --~--~---

Re: model question

2006-11-10 Thread Rob Slotboom
Thank you guys. Without a poll_id in vote it isn't possible to check integrity in the database so I keep it :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: Re: Paginator question

2006-11-10 Thread James Bennett
On 11/10/06, SmileyChris <[EMAIL PROTECTED]> wrote: > http://code.djangoproject.com/changeset/4041 That's probably not going to work for him; as he mentioned, he's on a pre-magic-removal version of Django, so any patch against current trunk isn't likely to be useful. -- "May the forces of evil

Re: Paginator question

2006-11-10 Thread SmileyChris
http://code.djangoproject.com/changeset/4041 On Nov 10, 8:24 pm, "Pythoni" <[EMAIL PROTECTED]> wrote: > Thank you for your reply > Where can I download the patch? > I still use 0.91 Django version --~--~-~--~~~---~--~~ You received this message because you are s

Re: tabindex HTML attribute: any way to assign to form fields in Generic Views?

2006-11-10 Thread Ivan Sagalaev
Twitchmedia wrote: > Does anyone know if it's possible to assign tabindex values to forms in > a Generic View within the template? Since the INPUT fields are > automatically generated Yet still you have access to raw data. Instead of: {{ form.myfield }} you can write something like: