IntegrityError when creating a brand new model instance

2013-02-07 Thread Some Developer
I have a model for a Tag object with simply has two fields. A title (which has the unique constraint) and a description. I also have a FormView based view class which handles the creation of Tag objects. When I try and save the object in the form_valid() method I always get an IntegrityError s

Re: post_save signal getting called twice !

2013-02-07 Thread vijay shanker
Thanks Evans.That was helpful. :) On Thursday, February 7, 2013 7:54:36 PM UTC+5:30, Tom Evans wrote: > > On Thu, Feb 7, 2013 at 1:54 PM, vijay shanker > > > wrote: > > Hi > > I am using django version 1.4.3 > > I am using two signals in my models.py > > one is m2m_changed, so i can have a c

Re: Why doesn't form_valid() in FormView take a request argument?

2013-02-07 Thread Rainy
On Thursday, February 7, 2013 3:39:43 AM UTC-5, Some Developer wrote: > > On 06/02/13 23:00, Rainy wrote: > > On Wednesday, February 6, 2013 3:09:39 PM UTC-5, Some Developer wrote: > > > > Why doesn't the form_valid() (and for that matter the > form_invalid()) > > method in the FormV

Re: Access to data via many-to-many while in save()

2013-02-07 Thread Mike Dewhirst
Much more clearly expressed here ... https://docs.djangoproject.com/en/1.4/topics/db/models/#extra-fields-on-many-to-many-relationships On 7/02/2013 5:04pm, Derek wrote: I am trying to access the field(s) of a Child table while still inside the save method of the Parent table. Assuming that t

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread Sam Solomon
Glad you figured it out! On Thu, Feb 7, 2013 at 2:55 PM, robertlnewman wrote: > Just thought I would wrap this up. Turns out the problem was that my > sysadmin did not have the port I wanted (8788) open to traffic. My syntax > was correct. The problem was a network one. > > Sam - I sincerely app

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread robertlnewman
Just thought I would wrap this up. Turns out the problem was that my sysadmin did not have the port I wanted (8788) open to traffic. My syntax was correct. The problem was a network one. Sam - I sincerely appreciate your help in (a) verifying that my syntax looked good, and (b) describing some

Appscale and Django

2013-02-07 Thread Henrik Genssen
Hi all, is someone on the list using Appscale [1] with Django? If yes, what is your setup (MySQL, Mongo, E2, Eucalyptus [2], KVM, etc.) What is your experiance towards stalability, reliability and performance? [1] http://appscale.cs.ucsb.edu [2] http://www.eucalyptus.com regards Henrik -- You

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread robertlnewman
Okay no worries. Just thought you might have had some mod_wsgi 'secret sauce'. Graham Dumpleton himself acknowledges that the docs for mod_wsgi are outdated in some respects (see the comments at the foot of his article), so you never know. Thanks again. I appreciate your time. - Rob On Feb 7,

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread Sam Solomon
Regarding having WSGIDaemonProcess outside of vhosts, as explained in the comment I added, it allows you to use the same process to handle requests from multiple vhosts. As for the rest, I honestly don't remember why or where they came from, I just know that this is probably not all that common (m

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread robertlnewman
Hi Sam, Thanks for the reply. Very interesting. So you define each WSGIDaemonProcess outside of the vhosts and then call it from within the vhost block? What is the advantage of that? Or is it just 6-of-one, half-a-dozen of another? Also, I notice that you are passing a bunch more args to WSGIS

Django fixture load DeserializationError: 'unicode' object has no attribute 'pk'?

2013-02-07 Thread Kaloian
Hello, I am getting the following error when trying to run my tests with fixtures: File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 190, in handle for obj in objects: File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/j

Re: Django and mod_wsgi serving different apps from separate virtual hosts on the same server

2013-02-07 Thread Sam Solomon
Can't spot any issues but here is what we have to run multiple staging versions of our site: group_* names are more descriptive in the actual settings WSGIDaemonProcess group_1 processes=1 threads=100 display-name=%{GROUP} inactivity-timeout=30 #defining it out here allows you to use the same

Re: Any good books for learning django?

2013-02-07 Thread frocco
Thanks for the recommend. I just purchased it. On Thursday, February 7, 2013 1:10:01 PM UTC-5, Mayukh Mukherjee wrote: > > I'd recommend two scoops of django. > It's a little more intermediate level but it's a gem. > > Sent from my iPhone > > On Feb 7, 2013, at 12:49, frocco > wrote: > > Hello, >

Re: How to create a Django Group in case of multiple databases.

2013-02-07 Thread Tom Evans
On Thu, Feb 7, 2013 at 12:16 PM, laxglx wrote: > > Hello Everybody, > > I'm going to create a Group using Django Group. > > I have two databases one is "master" and another is "slave" > In master I created a user and group as usual. > > And in slave database I tried like this: > > Group.objec

Re: Any good books for learning django?

2013-02-07 Thread Tom Evans
On Thu, Feb 7, 2013 at 5:49 PM, frocco wrote: > Hello, > Most of what I find are dated, 2008,2009. > Are these still good for learning django 1.4? > > Which books do you recommend? > > Thanks An often overlooked resource is the django documentation itself. The index page is arranged in complexity

Re: Any good books for learning django?

2013-02-07 Thread Mayukh Mukherjee
I'd recommend two scoops of django. It's a little more intermediate level but it's a gem. Sent from my iPhone On Feb 7, 2013, at 12:49, frocco wrote: Hello, Most of what I find are dated, 2008,2009. Are these still good for learning django 1.4? Which books do you recommend? Thanks -- You

Any good books for learning django?

2013-02-07 Thread frocco
Hello, Most of what I find are dated, 2008,2009. Are these still good for learning django 1.4? Which books do you recommend? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from i

Re: Formsets and auto_id's

2013-02-07 Thread David
I've kinda managed to achieve what I want but I can't help but think it's a bit of a fudge: Especially this part: form.id.html_name -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from

Formsets and auto_id's

2013-02-07 Thread David
Hi I have a formset. Each form will only contain a checkbox. This checkbox needs to indicate which PK the form applies to. The idea is that a user can scroll through this formset. Check which records they wish to delete and then remove them through a delete view. auto_id's always seem to show

Re: No module named models again

2013-02-07 Thread Kelly Nicholes
Yeah, for things like forms.py and views.py, it's best to use relative imports for the models.py within the same app. from .models import Object1 On Wednesday, February 6, 2013 7:22:19 PM UTC-7, frocco wrote: > > I found the answer. > in my app directory called checkout, I also have a checkout.

Re: post_save signal getting called twice !

2013-02-07 Thread Tom Evans
On Thu, Feb 7, 2013 at 1:54 PM, vijay shanker wrote: > Hi > I am using django version 1.4.3 > I am using two signals in my models.py > one is m2m_changed, so i can have a counter field (numcounter) of number of > m2m fields attached, and another is post_save so i can decide whether to > have a One

post_save signal getting called twice !

2013-02-07 Thread vijay shanker
Hi I am using django version 1.4.3 I am using two signals in my models.py one is m2m_changed, so i can have a counter field (numcounter) of number of m2m fields attached, and another is post_save so i can decide whether to have a OneToOneField (cartrule, is to be applied only if there are more t

post_save signal handler gets called twice !

2013-02-07 Thread vijay shanker
Hi I am using django version 1.4.3 I am using two signals in my models.py one is m2m_changed, so i can have a counter field (numcounter) of number of m2m fields attached, and another is post_save so i can decide whether to have a OneToOneField (cartrule, is to be applied only if there are more t

Re: Is there any way to apply a constraint on ForeignKey/OneToOneField being attached to any model based on some condition ?

2013-02-07 Thread Huu Da Tran
You could overwrite the save() method... or if you are populating from a form, overwrite the clean() method. On Thursday, February 7, 2013 3:23:54 AM UTC-5, vijay shanker wrote: > > Hi > I have these two models Cart and CartItem, > > class Cart(models.Model): > cart_id = models.Ch

Re: Update / collectstatic / loadfixtures automation

2013-02-07 Thread Huu Da Tran
On Sunday, February 3, 2013 11:17:15 AM UTC-5, Thiago wrote: > Yeah, it worked =) > I tryed --noinput before but the behavior is a little different. > Thanks! > In what sense is the --noinput different? Also, I would suggest you split your script into two... restart.sh that would contain all lo

Re: Django ForeignKey versus ManyToManyField

2013-02-07 Thread Huu Da Tran
On Wednesday, February 6, 2013 1:39:30 AM UTC-5, vijay shanker wrote: > I have two models, a Customer model and a WishListItem model (which stores > products). I have option of either having a ManyToManyField in Customer to > WishListItem, or I can have a customer ForeignKey to customer for each

Re: Need guidance on static website conversion to Django

2013-02-07 Thread Steve Metivier
Thanks very much for the advice. I'm pretty sure that's the approach I'm going to take. --steve On Wednesday, February 6, 2013 3:59:59 PM UTC-7, Harry Houdini wrote: > > > Maintaining that many static files has really got to suck, this is where > Django is going to help you a lot. First step for

Re: Django superstars I should be following?

2013-02-07 Thread Amirouche
On Tuesday, February 5, 2013 9:51:17 PM UTC+1, Glyn Jackson wrote: > > I'm looking for suggestions on who to follow on twitter. > Who are the Django superstars, and the opinionated and guy/grils I should > be following? > Me of course... Github following is i

How to create a Django Group in case of multiple databases.

2013-02-07 Thread laxglx
Hello Everybody, I'm going to create a Group using Django Group. I have two databases one is "master" and another is "slave" In master I created a user and group as usual. And in slave database I tried like this: *>>> Group.objects.db_manager('slave').create(name="grp1")* This returned an

Re: m2m_changed signal can not distinguish between existing and newly added instances

2013-02-07 Thread vijay shanker
well .. odd .. replying my own post .. kwargs['action'] A string indicating the type of update that is done on the relation. This can be one of the following: "pre_add"Sent *before* one or more objects are added to the relation. "post_add"Sent *after* one or more objects are added to the relati

Re: Why doesn't form_valid() in FormView take a request argument?

2013-02-07 Thread Some Developer
On 06/02/13 23:00, Rainy wrote: On Wednesday, February 6, 2013 3:09:39 PM UTC-5, Some Developer wrote: Why doesn't the form_valid() (and for that matter the form_invalid()) method in the FormView generic class based view take a request argument? I've found that if you have a for

Is there any way to apply a constraint on ForeignKey/OneToOneField being attached to any model based on some condition ?

2013-02-07 Thread vijay shanker
Hi I have these two models Cart and CartItem, class Cart(models.Model): cart_id = models.CharField(max_length= 50, null=False) customer= models.ForeignKey(Customer,null=True,blank=True) cartitems = models.ManyToManyField(CartItem,null=True) applied

Is there any way to stop foreignkey being attached to a django model depending upon some constraint ?

2013-02-07 Thread vijay shanker
Hi I have these two models Cart and CartItem, class Cart(models.Model): cart_id = models.CharField(max_length=50, null=False) customer= models.ForeignKey(Customer,null=True,blank=True) cartitems = models.ManyToManyField(CartItem,null=True) applied_