Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread shabda
My models.py class Foo(models.Model): name = models.CharField(max_length = 100) def save(self): self.id = None super(Foo, self).save() class Bar(Foo): created = models.DateTimeField(auto_now_add = 1) This gives me, In [1]: from djcalendar.models import Foo In

Re: contrib admin and admindocs problem

2008-10-12 Thread Nash
I get this error, you can see a paste here: http://dpaste.com/83932/ The admin site doesn't work on production at all, on the testserver it works after a refresh. On Oct 11, 4:40 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Oct 10, 2008 at 4:45 PM, Michael Graz <[EMAIL

Blank and null values for a foreign key

2008-10-12 Thread Fabio Natali
Hi all! I have two models, Person and License. class License(models.Model): number = models.IntegerField(max_length=10) class Person(models.Model): name = models.CharField(max_length=30) license = models.ForeignKey(License,verbose_name="Centro di

Re: array grouping in templates

2008-10-12 Thread Steve Holden
Daniel Roseman wrote: > On Oct 11, 7:58 am, jhf555 <[EMAIL PROTECTED]> wrote: > >> I have an array and I want to use Django templating to display each >> item in a table, grouped by 3 per row. >> For example, if i have >> arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] >> Then I'd

Re: contrib admin and admindocs problem

2008-10-12 Thread James Bennett
On Sun, Oct 12, 2008 at 5:51 AM, Nash <[EMAIL PROTECTED]> wrote: > I get this error, you can see a paste here: http://dpaste.com/83932/ > The admin site doesn't work on production at all, on the testserver it > works after a refresh. You appear to have an error in your own code, as evidenced by

Re: Building Django web application

2008-10-12 Thread Steve Holden
mguthrie wrote: > The following link seems to support Graham's conclusion: > > http://www.technobabble.dk/2008/aug/25/django-mod-wsgi-perfect-match/ > > Since Graham was a major contributor to mod_python and is the author of mod_wsgi it would be surprising if he'd given you anything other than

Re: array grouping in templates

2008-10-12 Thread Tim Chase
> I have an array and I want to use Django templating to display each > item in a table, grouped by 3 per row. > For example, if i have > arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] > Then I'd want it to show up as > > abc > def > ghi > j > > > In general, the array

Re: Blank and null values for a foreign key

2008-10-12 Thread Gerard Petersen
Fabio, If you define de foreignkey in the license model, you can create persons without a problem. The only requirement then for creating a license would be that it needs an existing person. Something like this: class Person(models.Model): name = models.CharField(max_length=30)

Re: Why does MySql gives warning? Incorrect string value: '\xE6\x9D\xB1\xE8\xA8\xBC...' for column 'title' at row 1

2008-10-12 Thread felix
thanks too for this. rather than alter the table manually of course, it should have been created correctly the first time. mysql will create new tables with the character encoding of the database. you can set that this way: alter database cruxxial_md CHARACTER SET = utf8; now tables created

Re: Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread felix
well this is interesting and curious what you are trying to do. why are you trying to do this self.id= None ? what is the real world purpose ? can you give a non abstract example ? in any case since Bar is a subclass of Foo there are two database tables. you set Bar id to None, but the object

Re: Blank and null values for a foreign key

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 5:45 AM, Fabio Natali <[EMAIL PROTECTED]>wrote: > > ... > As you can see, a new person can be added with no license at all: > "blank=True,null=True" options. That's what I want. > > In my admin panel I get the list of all the persons I have added. I > wish I could filter

Re: Why does MySql gives warning? Incorrect string value: '\xE6\x9D\xB1\xE8\xA8\xBC...' for column 'title' at row 1

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 9:56 AM, felix <[EMAIL PROTECTED]> wrote: > but what does the unittest runner do ?? (since it creates its own > database) > > it also creates a latin1 db: > > CREATE TABLE `website_releasefeedback` ( > ... > ) ENGINE=MyISAM DEFAULT CHARSET=latin1 > Use this setting:

Exception Value: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)

2008-10-12 Thread kele
i am using the django 1.0 , and while i am try to post some data (japanes ,chinese characters) and insert to my Mysql db , i got this error . my table is create in utf8 character , and my setting.py already has the DEFAULT_CHARSET = 'utf-8' , where going wrong ?? i am getting MAD in this .

macports and django problem

2008-10-12 Thread David Koppstein
Hi, I seem to have come across this problem while trying to install Django using Macports: http://mail.python.org/pipermail/pythonmac-sig/2007-September/019181.html Basically, the django install succeeds, but when I enter the python toplevel and do 'import django' I get an ImportError. As

Extend a field of an abstract model

2008-10-12 Thread mrsource
I have defined an abstract Model with some fields: class Componente(models.Model): name = models.CharField(max_length=80,unique=True) description = models.TextField(blank=True) class Meta: abstract = True and then in the derived class I would to define verbose_name property

Re: macports and django problem

2008-10-12 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-10-12, o godz. 17:26, przez David Koppstein: > I have updated my $PATH variable properly: > /sw/bin:/sw/sbin:/macosx-bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ > local/bin:/usr/X11/bin:/usr/X11R6/bin:/Users/david/bin:/sw/bin:/sw/ >

Re: macports and django problem

2008-10-12 Thread David Koppstein
Thanks Jarek. I got it to work -- it is actually not the /opt/local/bin, but rather the /opt/local/Library/Frameworks/Python.framework/Versions/Current/bin that has the "right" python. Thanks for your help! I still don't like that there are multiple versions of Python on my computer, though

Which IDE do you choose with django?

2008-10-12 Thread zjffdu
I am a newbie of django, and want to know which IDE is suit for django? thank your --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

RE: model definition must come before reference in models.ForeignKey?

2008-10-12 Thread Fenwick, Jacob L.
Thanks Malcom, that was helpful. Jacob -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Tredinnick Sent: Friday, October 10, 2008 8:41 PM To: django-users@googlegroups.com Subject: Re: model definition must come before reference in

ManyToManyFieldManager in post_save signal

2008-10-12 Thread Viktor
Hi, I have three simple models Project and Member, where Project.member is a ManyToManyField to User through Member then I would like to add some post save action when a new member is added to a project. Should I connect this signal to Project or to Member? Of course, new members can be added

Re: Exception Value: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 11:09 AM, kele <[EMAIL PROTECTED]> wrote: > > i am using the django 1.0 , and while i am try to post some data > (japanes ,chinese characters) and insert to my Mysql db , i got this > error . my table is create in utf8 character , and my setting.py > already has the >

Re: ManyToManyFieldManager in post_save signal

2008-10-12 Thread Alex Koshelev
There is not way track M2M field change with post_save signal. You can write your own derived M2M field class with needed hooks. On Oct 12, 9:01 pm, Viktor <[EMAIL PROTECTED]> wrote: > Hi, > > I have three simple models Project and Member, where Project.member is > a ManyToManyField to User

Ordering object collection by computed field?

2008-10-12 Thread Peter Krantz
Hi! I have a model like this: class Thing(models.Model): x = models.PositiveIntegerField() y = models.PositiveIntegerField() def z(self): return self.x / self.y * A_CONSTANT In a view I would like to retrieve a collection of Things ordered by z (the computed field). I expected

How can I check which view is being called in response to a specific Url?

2008-10-12 Thread shabda
One of my views is returning a Http404, and I think it is calling a view function diffrent from what I am expecting to be called. So How can I check which view is being called in response to a specific Url? --~--~-~--~~~---~--~~ You received this message because

Re: How can I check which view is being called in response to a specific Url?

2008-10-12 Thread Erik Allik
from django.core.urlresolvers import resolve view_func, args, kwargs = resolve('/your/url/here/') print '%s.%s' % (view_func.__module__, view_func.__name__) Erik On 12.10.2008, at 21:38, shabda wrote: > > One of my views is returning a Http404, and I think it is calling a > view function

Re: Which IDE do you choose with django?

2008-10-12 Thread mrsource
I'm using Eclipse with WTP (Web Tool Platform) and Pydev plugins. The eclipse debug interface is very powerful. On 12 Ott, 18:19, zjffdu <[EMAIL PROTECTED]> wrote: > I am a newbie of django, and want to know which IDE is suit for > django? > > thank your

Mysql with Django on Jython

2008-10-12 Thread Hingarajiya,Ravi
Hi All, I am using Jython for Django. I want to know that how to connect mysql to Django on Jython. Thanks in Advance Regards, Ravi Hingarajiya. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread shabda
As long as model_obj.id is None, Django does an Insert, I want an insert to happen all the time. (Sort of like trying to get FullHistory, wherein I can roll back my object to a previous state. I can do save(force_insert = True), but that also gives me an Exception.) On Oct 12, 6:32 pm, felix

Re: Ordering object collection by computed field?

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 2:12 PM, Peter Krantz <[EMAIL PROTECTED]>wrote: > > Hi! > > I have a model like this: > > class Thing(models.Model): > x = models.PositiveIntegerField() > y = models.PositiveIntegerField() > > def z(self): > return self.x / self.y * A_CONSTANT > > > In a view I

Custom form/formset for edit inline

2008-10-12 Thread Emil
Hi, I'm trying to figure out how to use a custom form for when editing objects inline in the admin. The case is something like this: I have Images that have foreign keys to image galleries. When editing a gallery, the images associated with it are edited inline. The image model has quite a few

Re: Mysql with Django on Jython

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 2:58 PM, Hingarajiya,Ravi <[EMAIL PROTECTED]>wrote: > Hi All, > > I am using Jython for Django. > > I want to know that how to connect mysql to Django on Jython. > > Thanks in Advance > You asked the same question yesterday, and nobody answered. That means nobody who

Attachment not recognized as such in EmailMultiAlternatives email

2008-10-12 Thread Loek Engels
Hi, When I create a EmailMultiAlternatives email and attach a PDF attachment after having provided both a text and HTML body the PDF attachment is not recognized as such by an email client (although the text and HTML representations are correctly displayed). It looks like the

Weird errors when i transfer from production to local ...

2008-10-12 Thread dbee
I'm bringing my django code base from production server to a clean install on development. The environments are different, but I'm getting some very strange errors that I don't seem to be able to figure out ... I was wondering if anyone had experienced the same issues ... Prod Server :

Re: Which IDE do you choose with django?

2008-10-12 Thread bruno desthuilliers
On 12 oct, 18:19, zjffdu <[EMAIL PROTECTED]> wrote: > I am a newbie of django, and want to know which IDE is suit for > django? Any decent text/code editor with support for Python and HTML will do. --~--~-~--~~~---~--~~ You received this message because you are

Re: How to detect changes in a model's fields before save() ?

2008-10-12 Thread bruno desthuilliers
On 11 oct, 02:59, zhango <[EMAIL PROTECTED]> wrote: > I'm overriding a model's save() method, and I want to detect changes > in values for some of the model's fields (i.e. differences between the > unsaved instance's values for some fields, and the values for those > same fields currently in the

Re: How to detect changes in a model's fields before save() ?

2008-10-12 Thread bruno desthuilliers
On 11 oct, 18:03, Donn <[EMAIL PROTECTED]> wrote: > Sounds like you should be doing something in the form's clean() function. You > can compare what's in the cleaned_data to what's in the model and then move > from there. And what if you didn't use a form to alter the model instance ?

Re: Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread felix
ah ok. you will have problems here because the parent class also has a database record and an id. it would be messy I think to try to fool django. better would be to make a kind of save_as or maybe you can copy the object and it will also copy its parent class. or make a specific method

Re: How can I check which view is being called in response to a specific Url?

2008-10-12 Thread felix
another way is to use the javascript Bookmarklet. go to Documentation > Bookmarklets also the debug footer http://www.djangosnippets.org/snippets/766/ is very useful, I just added in the code erik allik posted: from django.core.urlresolvers import resolve view_func, args,

Re: Weird errors when i transfer from production to local ...

2008-10-12 Thread Daniel Roseman
On Oct 12, 8:46 pm, dbee <[EMAIL PROTECTED]> wrote: > I'm bringing my django code base from production server to a clean > install on development. The environments are different, but I'm > getting some very strange errors that I don't seem to be able to > figure out ... I was wondering if anyone

Re: Keeping track of song play count in django and flash

2008-10-12 Thread felix
i'm looking at this problem too. 1. either the flash player can send a javascript/ajax ping to a url where it can be logged 2. or the songfile can be a django served url which logs and then redirects to the actual static URL. probably the second is easiest. On Oct 10, 9:28 pm, M Godshall

Re: Which IDE do you choose with django?

2008-10-12 Thread Tim Chase
> I am a newbie of django, and want to know which IDE is suit > for django? I second the use of a good text editor. I'm a Vim user, but if Emacs is your thing, that would do, as would any other good text-editor (some folks swear by TextMate or Notepad++). Some folks do use Eclipse (with the

Re: Which IDE do you choose with django?

2008-10-12 Thread Anders Bergh
On Sun, Oct 12, 2008 at 6:19 PM, zjffdu <[EMAIL PROTECTED]> wrote: > > I am a newbie of django, and want to know which IDE is suit for > django? > > thank your I use Komodo Edit, it's free and it has Python auto-completion etc. It runs on Windows, OS X and Linux. -- Anders Bergh

Re: Which IDE do you choose with django?

2008-10-12 Thread Rob Sutherland
On Sun, Oct 12, 2008 at 3:01 PM, Tim Chase <[EMAIL PROTECTED]> wrote: > Emacs is your thing, that would do, as would any other good > text-editor (some folks swear by TextMate or Notepad++). > I use Komodo Editor - http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml - I find that

Re: Which IDE do you choose with django?

2008-10-12 Thread Gerard Petersen
My personal favorite is "Editra" Regards, Gerard. zjffdu wrote: > I am a newbie of django, and want to know which IDE is suit for > django? > > thank your > > -- urls = { 'fun': 'www.zonderbroodje.nl', 'tech': 'www.gp-net.nl' } --~--~-~--~~~---~--~~ You

Get m2m id to update the m2m model.

2008-10-12 Thread xkill
Hello, I try to update a m2m relation. So this is the problem: models.py --- from django.db import models class instruments(models.Model): name = models.CharField(max_length=10) class people(User): objects = UserManager() phone = models.CharField(max_length=9,

Re: Which IDE do you choose with django?

2008-10-12 Thread Jeff Anderson
zjffdu wrote: > I am a newbie of django, and want to know which IDE is suit for > django? > I'd say that it'd be good to continue using whatever IDE you use for your other Python development. Django is, after all, simply Python code that you call from your code. Jeff Anderson signature.asc

Re: Which IDE do you choose with django?

2008-10-12 Thread Marco Bazzani
On Sun, Oct 12, 2008 at 11:32 PM, Jeff Anderson <[EMAIL PROTECTED]>wrote: > zjffdu wrote: > > I am a newbie of django, and want to know which IDE is suit for > > django? > > > I'd say that it'd be good to continue using whatever IDE you use for > your other Python development. Django is, after

Is trunk usually stable enough to run in a development server?

2008-10-12 Thread jmat
Just curious what anyones suggestions are for running satchmo on a dev server? Is trunk stable enough to develop a new site on (perhaps anticipating the site being done soon after the .8 release)? If so do you have any (general) suggestions on how to stay relatively up to date with the code

Re: Which IDE do you choose with django?

2008-10-12 Thread James Matthews
WingIde for python code and e-text editor for templates (sometimes notepad++) On Sun, Oct 12, 2008 at 3:08 PM, Marco Bazzani <[EMAIL PROTECTED]>wrote: > > > On Sun, Oct 12, 2008 at 11:32 PM, Jeff Anderson <[EMAIL PROTECTED]>wrote: > >> zjffdu wrote: >> > I am a newbie of django, and want to know

Re: Is trunk usually stable enough to run in a development server?

2008-10-12 Thread jmat
Oops sorry to many groups open, this was meant for the satchmo group. On Oct 12, 3:17 pm, jmat <[EMAIL PROTECTED]> wrote: > Just curious what anyones suggestions are for running satchmo on a dev > server?  Is trunk stable enough to develop a new site on (perhaps > anticipating the site being

Re: Weird errors when i transfer from production to local ...

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 4:25 PM, Daniel Roseman < [EMAIL PROTECTED]> wrote: > On Oct 12, 8:46 pm, dbee <[EMAIL PROTECTED]> wrote: > > ### ERROR 2 ### > > > Exception Type: ProgrammingError at /blog/venture-capital-pitfalls/ > > Exception Value: ERROR: operator does not exist: character varying

Re: Is trunk usually stable enough to run in a development server?

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 6:17 PM, jmat <[EMAIL PROTECTED]> wrote: > > Just curious what anyones suggestions are for running satchmo on a dev > server? Is trunk stable enough to develop a new site on (perhaps > anticipating the site being done soon after the .8 release)? > > > If so do you have

Re: Get m2m id to update the m2m model.

2008-10-12 Thread Russell Keith-Magee
On Mon, Oct 13, 2008 at 5:27 AM, xkill <[EMAIL PROTECTED]> wrote: > > Hello, > > I try to update a m2m relation. > > So this is the problem: > > models.py > --- > from django.db import models > > class instruments(models.Model): >name = models.CharField(max_length=10) > > class

MySQLdb adapter

2008-10-12 Thread Narshe
I'm running Windows XP with WAMPSERVER 2.0 installed. Python2.6 MySQL is installed on my computer at this location: C:\wamp\bin\mysql Here is how my settings.py is set up: DATABASE_ENGINE = 'mysql' DATABASE_NAME = 'pythonDB' DATABASE_USER = 'py' DATABASE_PASSWORD = '#py' DATABASE_HOST = ''

Re: MySQLdb adapter

2008-10-12 Thread Karen Tracey
On Sun, Oct 12, 2008 at 8:08 PM, Narshe <[EMAIL PROTECTED]> wrote: > > I'm running Windows XP with WAMPSERVER 2.0 installed. Python2.6 > MySQL is installed on my computer at this location: C:\wamp\bin\mysql > Here is how my settings.py is set up: > [snip] > running build_ext > building '_mysql'

Re: MySQLdb adapter

2008-10-12 Thread Narshe
I was hoping I wouldn't have to use 2.5 instead of 2.6 but thats what it looks like I must do. Thanks for the look into my problem. On Oct 12, 5:39 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sun, Oct 12, 2008 at 8:08 PM, Narshe <[EMAIL PROTECTED]> wrote: > > > I'm running Windows XP with

Re: Problem with i18n - "en_US" locale translations coming through for "en"

2008-10-12 Thread cardhu
Hi Fran, Sorry if I can't help but I've been looking myself for a possibly quick answer to a strange problem regarding i18n. I am running latest svn rev and the strangest thing is that in the admin app I am presented with both LANGUAGES and LANGUAGE_CODE. My custom templates however do not

Re: How to unit test form clean methods

2008-10-12 Thread reyjexter
you can simply create a form on your test case and pass in dictionary to mimic request parameters. I have blogged about it and you can find it here: http://www.reyjexter.com/post/unit-testing-django-component-example -rey On Oct 13, 9:30 am, meppum <[EMAIL PROTECTED]> wrote: > I would like to

Re: Which IDE do you choose with django?

2008-10-12 Thread reyjexter
I use pydev because I'm more of an eclipse guy -rey On Oct 13, 12:19 am, zjffdu <[EMAIL PROTECTED]> wrote: > I am a newbie of django, and want to know which IDE is suit for > django? > > thank your --~--~-~--~~~---~--~~ You received this message because you are

Re: How to unit test form clean methods

2008-10-12 Thread James Bennett
On Sun, Oct 12, 2008 at 8:30 PM, meppum <[EMAIL PROTECTED]> wrote: > I would like to be able to unit test my forms. Specifically, I'd like > to be able to test individual clean methods, but I get errors when I > try to call cleaned methods directly. Below is an example of testing a > registration

Re: Extend a field of an abstract model

2008-10-12 Thread Malcolm Tredinnick
On Sun, 2008-10-12 at 08:55 -0700, mrsource wrote: > I have defined an abstract Model with some fields: > > class Componente(models.Model): > name = models.CharField(max_length=80,unique=True) > description = models.TextField(blank=True) > class Meta: > abstract = True > >

Re: Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread Malcolm Tredinnick
On Sun, 2008-10-12 at 00:16 -0700, shabda wrote: > My models.py > > class Foo(models.Model): > name = models.CharField(max_length = 100) > > def save(self): > self.id = None > super(Foo, self).save() > > class Bar(Foo): > created = models.DateTimeField(auto_now_add

makemessages create invalid msgid in django.po file

2008-10-12 Thread Chuck Bai2
The base language of my site is Chinese. I want to change to English when user select language perferrence. In my base.html, I have {% trans "产品" %} I generated django.po file using django-admin.py makemessages -l en In django.po file of en locale, #: .\templates\base.html.py:36 msgid "å…¬å

Handling Dynamic Image Uploads

2008-10-12 Thread Justin
Hi, I can't figure out how to handle image uploads in a form that accepts a variable number of uploads. I would happily use Django newforms to take care of it, but I'm using a form that can be extended to include multiple file uploads (implemented by dynamically adding file input tags to the

Re: Which IDE do you choose with django?

2008-10-12 Thread oso che bol
Hi, How do you think about Eric4.2.1 with Django plugin? Regards, -LN On Mon, Oct 13, 2008 at 9:28 AM, reyjexter <[EMAIL PROTECTED]> wrote: > > I use pydev because I'm more of an eclipse guy > > -rey > > On Oct 13, 12:19 am, zjffdu <[EMAIL PROTECTED]> wrote: > > I am a newbie of django, and