Can the admin site link foreign keys?

2009-04-29 Thread Rex
Let's say I've got two models: User, and Country. Each user is from one country, and each country has multiple users. so the User model contains a ForeignKey for a Country object. Can I do either of the following through the Django admin web interface? (1) When I'm looking at the list of Users,

Django, FCGI, Cherokee. Spawning PHP Processes and detaching?

2009-04-29 Thread aaron smith
Hey All, Sorry If I don't have some of this terminology correct. Here's my problem. I have a django app, which I'm serving with Cherokee and FCGI. My django app manages a bunch of stuff, and has to make a couple calls to an external soap service, to record some customer data. Unfortunately, I

Re: url template tag help

2009-04-29 Thread Julián C . Pérez
uhhh i tried but nooo... your suggestion doesn't work... let me show you 2 versions of error... 1. "Reverse for 'proyName.view_aboutPage' with arguments '()' and keyword arguments '{}' not found." settings: # in proyName.packages.appName.urls.py: ... url(r'^about/$', 'view_aboutPage',

Re: Saving Multiple forms? or fields... confused.

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 4:00 PM, tdelam wrote: > > Hi, > > I am building a small survey app, questions are added to a survey > through django-admin, I am building the form dynamically, when the > form is submitted I only get the first form saving, here is the code: >

Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez
OMG! excellent, kevin... just what i wanted! works smooth and nice thanks a lot ;) On Apr 29, 12:42 pm, Kevin Audleman wrote: > You're in luck, I just programmed this exact thing: > > Define the following function right above your model: > > def

contrib.auth Group class

2009-04-29 Thread CrabbyPete
Is there any advantage to using the Group class in contrib.auth, over making your own group. Or is it best to extend Group? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

mystery with my form being saved

2009-04-29 Thread Milan Andric
Hello, I've been banging my head on this for several hours ... for some reason on my reservation edit view, the start_when field will not save but summary does. The assertEquals always fails on line 198 in the paste below. Do you see anything fishy here? http://dpaste.com/39489/ Is it

Re: Custom primary key

2009-04-29 Thread Timboy
Thank you for your time and response Malcom, I appreciate it very much. On Apr 29, 3:42 pm, Malcolm Tredinnick wrote: > On Wed, 2009-04-29 at 15:37 -0700, Timboy wrote: > > I am trying to make a pk for an object that starts with the year > > followed by seven

Re: manage.py syncdb error

2009-04-29 Thread David
it works now. thanks Kai. On Apr 29, 3:54 pm, Kai Kuehne wrote: > No TOFU please. > > On Thu, Apr 30, 2009 at 12:49 AM, David wrote: > > sorry i can not find a database that table > > 'auth_permission' belongs to. any more hints what i should do? > > Did

Re: manage.py syncdb error

2009-04-29 Thread Kai Kuehne
No TOFU please. On Thu, Apr 30, 2009 at 12:49 AM, David wrote: > sorry i can not find a database that table > 'auth_permission' belongs to. any more hints what i should do? Did you FLUSH PRIVILEGES? --~--~-~--~~~---~--~~ You received this

Re: manage.py syncdb error

2009-04-29 Thread David
sorry i can not find a database that table 'auth_permission' belongs to. any more hints what i should do? thanks so much. On Apr 29, 3:35 pm, David wrote: > i see. i should grant priviliges on the database that table > 'auth_permission' belongs to.  let me do it. > > thanks.

Re: Custom primary key

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 15:37 -0700, Timboy wrote: > I am trying to make a pk for an object that starts with the year > followed by seven additional digits. YYXXX I want the digits to > automatically increase like normal. > > I'm guessing I need to pass force_insert=True to my save if not >

Custom primary key

2009-04-29 Thread Timboy
I am trying to make a pk for an object that starts with the year followed by seven additional digits. YYXXX I want the digits to automatically increase like normal. I'm guessing I need to pass force_insert=True to my save if not self.pk. I'd appreciate some advice. TIA

Re: manage.py syncdb error

2009-04-29 Thread David
i see. i should grant priviliges on the database that table 'auth_permission' belongs to. let me do it. thanks. On Apr 29, 3:32 pm, David wrote: > mysql> show grants; >

Re: How do you manage the depenedencies between your project and other open source?

2009-04-29 Thread Kai Kuehne
Hi, On Wed, Apr 29, 2009 at 10:44 PM, meppum wrote: > > Just wanted to get an idea of what tools others were using to manage > the dependencies between their code and other projects. For instance, > if I have a project that uses django registration, voting, and tags > I'd

Re: manage.py syncdb error

2009-04-29 Thread David
mysql> show grants; +-- + | Grants for da...@localhost | +-- + | GRANT USAGE ON

Re: manage.py syncdb error

2009-04-29 Thread Kai Kuehne
Hi, On Thu, Apr 30, 2009 at 12:17 AM, David wrote: > [error message] > anybody knows how to fix it? Grant CREATE permission for your user on that database. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

manage.py syncdb error

2009-04-29 Thread David
Hi, i followed django tutorial part 1 to learn django, however i met following error when i used "python manage.py syncdb". da...@django:~/mysite$ python manage.py syncdb Creating table auth_permission Traceback (most recent call last): File "manage.py", line 11, in

Re: Admin css being weird

2009-04-29 Thread Cole
just to add, the images are actually working fine.. On 29 Apr, 22:57, Cole wrote: > Hi, > > I've used Django a fair bit and have just installed it on a ubuntu- > based distro.  I've got everything working fine with apache2 and > mod_python but the admin css, > > I have

Admin css being weird

2009-04-29 Thread Cole
Hi, I've used Django a fair bit and have just installed it on a ubuntu- based distro. I've got everything working fine with apache2 and mod_python but the admin css, I have a soft link at /var/www/admin_media ponting to the admin media folder and going to something like:

Re: Forms vs Formsets vs Sessions vs FormWizard ??

2009-04-29 Thread TheCorp
Kevin, Your fuzzy memory is quite correct. After some research it seems that you definitely can't do that unless you do some tricky **kwargs stuff to get around it. The lesson here is that the HTTP spec doesn't want you to do that and the Django Framework actively dissuades you from doing things

Re: Finding Reason for Form.is_valid()

2009-04-29 Thread Alex Gaynor
On Wed, Apr 29, 2009 at 4:18 PM, Jari Pennanen wrote: > > Remember to check also: form.non_field_errors > > On Apr 29, 11:59 pm, Ayaz Ahmed Khan wrote: > > On 28-Apr-09, at 8:35 PM, Margie wrote: > > > > > I often put a break point using pdb > > > > >

Re: Finding Reason for Form.is_valid()

2009-04-29 Thread Jari Pennanen
Remember to check also: form.non_field_errors On Apr 29, 11:59 pm, Ayaz Ahmed Khan wrote: > On 28-Apr-09, at 8:35 PM, Margie wrote: > > > I often put a break point using pdb > > > import pdb > > pdb.set_trace() > > > This  causes the server (assuming you are using the django > >

Re: Login redirect url truncated

2009-04-29 Thread Bastien
Thanks Malcolm, That was very informative. I tried the percent encoding trick with no success. Now I'll try the second part and post here if I am successful. Thanks, Bastien On Apr 29, 6:50 pm, Malcolm Tredinnick wrote: > On Wed, 2009-04-29 at 07:43 -0700, Bastien

Saving Multiple forms? or fields... confused.

2009-04-29 Thread tdelam
Hi, I am building a small survey app, questions are added to a survey through django-admin, I am building the form dynamically, when the form is submitted I only get the first form saving, here is the code: http://dpaste.com/hold/39401/ Does anyone have any tips on how I can get the other ones

Re: Finding Reason for Form.is_valid()

2009-04-29 Thread Ayaz Ahmed Khan
On 28-Apr-09, at 8:35 PM, Margie wrote: > I often put a break point using pdb > > import pdb > pdb.set_trace() > > This causes the server (assuming you are using the django > development server) to drop to the pdb prompt when it hits the > set_trace(). > > Then I just print the form and look

Re: Detecting Disabled Cookies

2009-04-29 Thread Tim Chase
>> I thought this would be a common question, but Google doesn't show any >> Django-specific solutions. What's the general best practice for >> detecting disabled cookies in a single request? ^^^ > > Maybe this could help:

Re: Detecting Disabled Cookies

2009-04-29 Thread Gabriel .
On Wed, Apr 29, 2009 at 3:46 PM, Chris wrote: > > I thought this would be a common question, but Google doesn't show any > Django-specific solutions. What's the general best practice for > detecting disabled cookies in a single request? > Maybe this could help:

Detecting Disabled Cookies

2009-04-29 Thread Chris
I thought this would be a common question, but Google doesn't show any Django-specific solutions. What's the general best practice for detecting disabled cookies in a single request? Regards, Chris --~--~-~--~~~---~--~~ You received this message because you are

Re: Displaying content in different styles.

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 21:11 +0300, Oleg Oltar wrote: [...] > Is there a way to check in the loop if it's a first item. And if so to > process it in a different way? Or do I have pass first article to > template separately? Inside a for-loop you have access to a the counter for the loop and there

Displaying content in different styles.

2009-04-29 Thread Oleg Oltar
Hi! I created a simple view to display articles on my homepage. Here's the code: def homepage(request): news = models.Section.objects.get(section = 'News') articles = models.Article.objects.exclude(section = news.id ).order_by("-pub_date") list_of_news =

Re: Forms vs Formsets vs Sessions vs FormWizard ??

2009-04-29 Thread Kevin Audleman
TheCorp, My memory on the issue is rather fuzzy, but I seem to recall that you can't pass POST data along with a redirect, and that this has to do with the way HTTP is designed. Using session variables seems like an excellent idea in my opinion. One of the reason session variables were invented

Re: FileField uploading into an user-specific path

2009-04-29 Thread Kevin Audleman
You're in luck, I just programmed this exact thing: Define the following function right above your model: def upload_location(instance, filename): return 'profile_photos/%s/%s' % (instance.user.username, filename) My function uses 'profile_photos' as the base directory appended to

Re: Dynamic form and template rendering

2009-04-29 Thread Kevin Audleman
As is often the case in django, they have already provided a mechanism for what you are trying to do the hard way: Formsets. http://docs.djangoproject.com/en/dev/topics/forms/formsets/ Cheers, Kevin On Apr 29, 7:18 am, MarcoS wrote: > Hi all, >    I post a problem, hoping

Re: url template tag help

2009-04-29 Thread Kevin Audleman
You might be able to solve your problem by changing the name attribute of your URL to include "proyName": url(r'^about/$', 'view_aboutPage', name='proyName.view_aboutPage'), --- The error message is telling you exactly what it's looking for, after all: the error: "Reverse for

Re: url template tag help

2009-04-29 Thread Julián C . Pérez
jajaja it's not top secret what more information should i provide?? On 29 abr, 11:55, Malcolm Tredinnick wrote: > On Wed, 2009-04-29 at 08:10 -0700, Julián C. Pérez wrote: > > actually... i don't use underscores into my url or views names... > > that 'view_aboutPage'

Re: help, I want restrict usernames available for registrion.

2009-04-29 Thread j0s390
After some time, I got IT... Thanks for your response. Hre is the solution I got, and yeah - it a Python problem (regular expression) from django import forms from django.forms.util import ErrorList import re class ExtraRegForm(forms.Form): username=forms.CharField(min_length=4,

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Phil Mocek
On Wed, Apr 29, 2009 at 03:06:37PM +0800, Vincent wrote: > The situation is, i have model A and model B, B has a foreignkey > point to A,. > > now i find that i wanna delete records of A without deleting > records of B which pointing to A. You're trying to do something that a relational

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 01:36 -0700, Margie wrote: [...] > Would love to hear a summary of where this might be going from any > developers! I realize it is a tough problem - not complaining here. > Just trying to get a grip on what do do in my own app and whether > there are any changes coming and

Re: Admin menu not logging in

2009-04-29 Thread Phil Mocek
On Wed, Apr 29, 2009 at 09:34:55AM -0700, Jordash wrote: > How would I go about creating a super user? What I would do is use Google to search the Web for "django create superuser": and follow the link to the very first result:

Re: url template tag help

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 08:10 -0700, Julián C. Pérez wrote: > actually... i don't use underscores into my url or views names... > that 'view_aboutPage' was actually just a made up example name Sounds like you need to provide more accurate information then. Provide the actual data that is failing.

Re: url template tag help

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 03:17 -0700, Christian Berg wrote: > it also helps to rename the URL to view-about-page. Dashed do work. > It seems that URL Namen are bound to slug resitrictions. Slugs have nothing to do with it. If you can't use underscores in URL pattern names, it's a bug. Create a

Re: Admin menu not logging in

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 12:34 PM, Jordash wrote: > > Hey All, > > I'm really new to Django (have PHP background) > > I'm following this tutorial here: > > http://docs.djangoproject.com/en/dev/intro/tutorial01/ > > And for some reason a super user was never created during

Re: Login redirect url truncated

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 07:43 -0700, Bastien wrote: > Hi, > > I'm trying to get Django to do the following: > > A user must be logged in to comment on a content. If the user is not > logged in then I provide a link to the login page and use the 'next' > function to take her back to the content

Admin menu not logging in

2009-04-29 Thread Jordash
Hey All, I'm really new to Django (have PHP background) I'm following this tutorial here: http://docs.djangoproject.com/en/dev/intro/tutorial01/ And for some reason a super user was never created during the process and so I can't login to the /admin directory. How would I go about creating a

Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez
thanks... but... how can i make that attribute a callable tto work with user-specif paths?? On 29 abr, 03:18, Kip Parker wrote: > upload_to can be a callable > -http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield. > > On Apr 29, 4:59 am, "Carlos A. Carnero

Re: help, I want restrict usernames available for registrion.

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 10:01 AM, j0s390 wrote: > > I want all usernames to have at most two underscores and the > underscores not to be consercutive... > I tried this by creating an ExtraRegForm(models.Model) and putting > username=models.CharField(min_length=4,

Re: url template tag help

2009-04-29 Thread Julián C . Pérez
actually... i don't use underscores into my url or views names... that 'view_aboutPage' was actually just a made up example name On 29 abr, 05:17, Christian Berg wrote: > it also helps to rename the URL to view-about-page. Dashed do work. > It seems that URL Namen are bound

Login redirect url truncated

2009-04-29 Thread Bastien
Hi, I'm trying to get Django to do the following: A user must be logged in to comment on a content. If the user is not logged in then I provide a link to the login page and use the 'next' function to take her back to the content page where the comment box will be waiting for her to fill it. It

Re: Optimistic Locking in the Admin

2009-04-29 Thread Andrew Smith
Hello, I've recently been tackling almost the same thing. I'm using Google App Engine and app-engine-patch so I can't help you on the best method for implementing the optimistic locking at the database level to avoid race conditions (though I'm even more lost as to how to achieve the same thing

Dynamic form and template rendering

2009-04-29 Thread MarcoS
Hi all, I post a problem, hoping someone can help me: I want to render a dynamic form which many rows how the number of entries from a database table (something similar at the list in the "change_list.html" template in admin) This is the model: class Book(models.Model): title =

Re: django templating workaround needed

2009-04-29 Thread Kai Kuehne
Hi, On Wed, Apr 29, 2009 at 3:50 PM, deostroll wrote: > > Hi, > > I cannot render a template written like this: > [code] > > Please suggest a work around, thanx in advance. Try {% instead of (%. --~--~-~--~~~---~--~~ You received this

help, I want restrict usernames available for registrion.

2009-04-29 Thread j0s390
I want all usernames to have at most two underscores and the underscores not to be consercutive... I tried this by creating an ExtraRegForm(models.Model) and putting username=models.CharField(min_length=4, max_length=16) and tried the validation process by using re.search to see if username meets

django templating workaround needed

2009-04-29 Thread deostroll
Hi, I cannot render a template written like this: Name Phone Group

Re: ForeignKey Select List Filter

2009-04-29 Thread cfiles
Let me try to explain this a little more. Here are some example models class Account(models.Model): user = models.ForeignKey(User) name= models.CharField('Name on Account', max_length=100) description = models.CharField(max_length=100) date_added =

Re: Decoding django user password

2009-04-29 Thread Miguel
thank you guys! Miguel Sent from Madrid, Spain On Wed, Apr 29, 2009 at 2:22 PM, Ned Batchelder wrote: > > If you want to login as a user, don't bother with their password (which > can't be decoded anyway). Build another authorization mechanism into > your app so that

Sequence number generation

2009-04-29 Thread mettwoch
Hi, I'm rather new to Django (and webapp development) and I'd appreciate any advice on the following problem. I've a model named 'document' that can hold any kind of documents like customer invoices, supplier invoices, goods returned, ..., but I've to ensure that the customer invoices be

TypeError: coercing to Unicode: need string or buffer, ImageWithThumbnailsFieldFile found

2009-04-29 Thread joker
i am using sorl.thumbnail. i wanna use templatetags for my home page. i wanna show my special products on home page. i write templatetags # -*- coding: utf-8-*- from django.template import Library, Node from kent.emlak.models import Emlaklar register = Library() def vitrin_menu():

Re: dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
thanks, that was just what I was looking for :-) never used this**thing before On 29 Apr., 14:02, Daniel Roseman wrote: > On Apr 29, 12:09 pm, Dennis Schmidt > wrote: > > > > > > > Hi Mike, > > > thanks a lot but that was

Re: Decoding django user password

2009-04-29 Thread Ned Batchelder
If you want to login as a user, don't bother with their password (which can't be decoded anyway). Build another authorization mechanism into your app so that you can log in as them without a password. For example, you can accept a user name with a password of (superuser name, superuser

Re: annotation and grouping

2009-04-29 Thread Russell Keith-Magee
On Wed, Apr 29, 2009 at 4:08 PM, omat wrote: > > Hi all, > > I would like to fetch the latest entries for each user from a model > like: > > class Entry(models.Model): >    user = models.ForeignKey(User) >    entry = models.TextField() >    date =

Re: Decoding django user password

2009-04-29 Thread Kenneth Gonsalves
On Wednesday 29 April 2009 17:17:42 Miguel wrote: > is there any way to decode the passwords that django keeps the the > auth_user table? afaik it is one way only -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because

Re: Decoding django user password

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 7:47 AM, Miguel wrote: > Hello, > > is there any way to decode the passwords that django keeps the the > auth_user table? It would be really interesting to see if there is any > problems in the users part of the web when new information and tasks are >

Re: Decoding django user password

2009-04-29 Thread Masklinn
On 29 Apr 2009, at 13:47 , Miguel wrote: > Hello, > > is there any way to decode the passwords that django keeps the the > auth_user > table? No. The passwords are stored salted hashes (http://en.wikipedia.org/wiki/Salted_hash ), you can try brute-forcing them if you have *a lot* of time (and

Re: dynamic model field assignments

2009-04-29 Thread Karen Tracey
On Wed, Apr 29, 2009 at 7:09 AM, Dennis Schmidt wrote: > > Hi Mike, > > thanks a lot but that was unfortunately not what I ment. Your > assignmements are static in > > In [2]: n = TestFun(name="mike", description="Testing is always > fun.") > > but I need them to be

Admin change list filters as select boxes?

2009-04-29 Thread kurak
I have an application that needs lots of filters for object list in Admin app. The filters currently take up quite a lot of space (~1400px ) I'd like to change them to select boxes and my best idea to modify DOM with some javascript or to patch django (that I'd prefer not to) but I wonder if it

Re: dynamic model field assignments

2009-04-29 Thread Daniel Roseman
On Apr 29, 12:09 pm, Dennis Schmidt wrote: > Hi Mike, > > thanks a lot but that was unfortunately not what I ment. Your > assignmements are static in > > In [2]: n = TestFun(name="mike", description="Testing is always > fun.") > > but I need them to be dynamic. So in

Decoding django user password

2009-04-29 Thread Miguel
Hello, is there any way to decode the passwords that django keeps the the auth_user table? It would be really interesting to see if there is any problems in the users part of the web when new information and tasks are added via admin web. regards, Miguel Sent from Madrid, Spain

Re: dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
Hi Mike, thanks a lot but that was unfortunately not what I ment. Your assignmements are static in In [2]: n = TestFun(name="mike", description="Testing is always fun.") but I need them to be dynamic. So in the above case NAME wouldn't be hardcoded but come from a dictionary. {'name': 'mike'}

Re: Django on Amazon EC2

2009-04-29 Thread Jörn Paessler
Hi Joshua, we have been hosting our django sites on EC2 for about 9 months now. We are quite happy with it but there are some things you have to take care of: - we recently had a downtime, because the host system crashed. We had a new instance up and running pretty fast but you have to keep

Re: HTML Forms and Sessions - Help!

2009-04-29 Thread Alfonso
Daniel, Thanks.. point taken I'm still a bit of a n00b so bear with me: So I'm trying to store the form fields in sessions , user navigates to /search/ and can then use the search form there to search/refine the results. http://dpaste.com/hold/39182/ thats the main form and the code in

Re: dynamic model field assignments

2009-04-29 Thread Mike Ramirez
On Wednesday 29 April 2009 03:24:48 am Dennis Schmidt wrote: > Hi there, > > this might be a trivial question but my search within the django > documentation and google didn't give me any helpful results. > In Ruby on Rails you can simply do this > > x = Model.new({:param_x => 'x', :param_y =>

Re: Trying to figure out "featured for month" view

2009-04-29 Thread Christian Berg
i would do it the other way around. I would create a featured_object model containig a DateField and an ForeignKey to the Featured Thing. This should be more performant for a big directory like dmoz, sourceforge, freshmeat, happy penguin You could also add more Info this way. For Example

dynamic model field assignments

2009-04-29 Thread Dennis Schmidt
Hi there, this might be a trivial question but my search within the django documentation and google didn't give me any helpful results. In Ruby on Rails you can simply do this x = Model.new({:param_x => 'x', :param_y => 'y'}) where the params are some model fields. The hash you can provide

attributes in a model class

2009-04-29 Thread Waruna de Silva
Hi All, I'm new to python and django. Is there any method or way to get attributes in django.model class. Lets say i have django model called class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) address =

Re: url template tag help

2009-04-29 Thread Christian Berg
it also helps to rename the URL to view-about-page. Dashed do work. It seems that URL Namen are bound to slug resitrictions. On 29 Apr., 03:06, Julián C. Pérez wrote: > hi everyone > i need some help over here... please! > i don't know what it's wrong... > > the url i'm

Re: HTML Forms and Sessions - Help!

2009-04-29 Thread Daniel Roseman
On Apr 29, 10:15 am, Alfonso wrote: > Hi, > > Leading on from a post I made a few days ago I'm having real trouble > dealing with sessions to preserve form state and the standard HTML for > I placed in the template.  I can't seem to get to the session data for > the

Making First name/Last name required in User

2009-04-29 Thread Filip Gruszczyński
I would like to make First name and Last name to be required in User class from auth package. I believe enough would be to make forms in admin invalid, when name wasn't provided. Is it somehow possible to achieve, without changing Django code? -- Filip Gruszczyński

HTML Forms and Sessions - Help!

2009-04-29 Thread Alfonso
Hi, Leading on from a post I made a few days ago I'm having real trouble dealing with sessions to preserve form state and the standard HTML for I placed in the template. I can't seem to get to the session data for the form once submitted (via GET) and I'm wondering is that due to the fact it's

Optimistic Locking in the Admin

2009-04-29 Thread PierreR
Hello, I have been searching the group on the subject but have not managed to pull a satisfactory solution out of it. How is the recommended way to implement optimistic locking in the django admin ? Let's say I have a version field or timestamp sent to the user-agent together with the record

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Margie
I had a post on this recently that you would probably find relevant, see: http://groups.google.com/group/django-users/browse_frm/thread/582f21486c1073eb/8af00e9c0577a5e6?lnk=gst=margie#8af00e9c0577a5e6 Or search for "deletion of distant related objects" in this group. I'm still somewhat

Re: FileField uploading into an user-specific path

2009-04-29 Thread Kip Parker
upload_to can be a callable - http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield. On Apr 29, 4:59 am, "Carlos A. Carnero Delgado" wrote: > Oops, too quick to press reply :o > > On Tue, Apr 28, 2009 at 11:53 PM, Carlos A. Carnero Delgado > >

Re: How to deal with problem about ForeignKey

2009-04-29 Thread James Bennett
On Wed, Apr 29, 2009 at 3:59 AM, Daniel Roseman wrote: > You could try defining the foreign key with null=True. >    a = models.ForeignKey(A, null=True) Not really, since there's no support whatsoever for ON DELETE triggers in the ORM. -- "Bureaucrat Conrad,

annotation and grouping

2009-04-29 Thread omat
Hi all, I would like to fetch the latest entries for each user from a model like: class Entry(models.Model): user = models.ForeignKey(User) entry = models.TextField() date = models.DateTimeField(auto_now_add=True) Is it possible with the current API with a single query? I.e.,

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Daniel Roseman
On Apr 29, 8:06 am, Vincent wrote: > No, i did not mean this. > The situation is, i have model A and model B, B has a foreignkey point to > A,. > > now i find that i wanna delete records of A without deleting records of B > which pointing to A. > i think i could reset the B's

Re: Django on Amazon EC2

2009-04-29 Thread creecode
Hello Joshua, I don't have any detail or tips. You just need to get to grips with using EC2 and then install Django on your instance. I've been using Django on an EC2 instance since late last year and they work fine together. I use S3 as my main media server via S3Storage. On Apr 28, 8:41 

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Vincent
No, i did not mean this. The situation is, i have model A and model B, B has a foreignkey point to A,. now i find that i wanna delete records of A without deleting records of B which pointing to A. i think i could reset the B's foreignkey field to integerfield. But i consider it is not the best

Re: Dynamic forms?

2009-04-29 Thread Matias Surdi
tdelam escribió: > Hi Guys, > > This might get lengthy but I am trying to get some insight on the best > way to generate some dynamic forms in a template. The project is a > survey. Here is my questions model: > > class Question(models.Model): > TRUEFALSE = 1 # a radio button yes/no

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Marcelo Ramos
On Wed, Apr 29, 2009 at 2:57 AM, Vincent wrote: > Hi, > I got a problem like this: > class A(models.Model): >     id = models.AutoField(primary_key=True) >     field1 = models.TextField() > class B(models.Model): >     a = models.ForeignKey(A) >     field1 = models.TextField()