How to add a ManyToManyField at runtime?

2012-09-13 Thread James Pic
Hello everybody, This is what I'm trying to do: def test_basic_addition(self): # create field f = models.ManyToManyField(to=X, related_name='bar') f.contribute_to_class(Y, 'x') # create table field = Y._meta.get_field_by_name('x')[0] through =

Possible issue with admindoc templates

2011-12-19 Thread James Pic
Hello everybody, Consider such a setup: templates/base.html: loads jquery in {% block jquery %} templates/admin/base_site.html: extends base.html, sets {% block jquery %}{% endblock %} so that the parent template doesn't interfere with django admin's loading of jquery That worked pretty well unt

Re: DJANGO_SETTINGS_MODULE problem

2011-11-15 Thread James Pic
On Tue, Nov 15, 2011 at 6:48 PM, Tim Sawyer wrote: > I've done this. > > You should be able to startup the test server with > --settings=client_settings/foo.py and get all of settings.py and HELLO > available to you. > FTR >>> ./manage.py shell --settings=client_settings.foo In [1]: from django

DJANGO_SETTINGS_MODULE problem

2011-11-15 Thread James Pic
Hi all, I don't understand something about DJANGO_SETTINGS_MODULE. My intention is to serve several websites from the same project installation, by creating a subdir of website-specific settings. project_root/   settings.py   client_settings/     __init__.py     foo.py     bar.py     etc So

Re: Fill in form + user first time

2010-03-02 Thread James Pic
Hello everybody, On Tue, Mar 2, 2010 at 11:14 PM, GoSantoni wrote: > Is it reasonable easy to achieve a form for users with in the end the > opportunity to register or login? I'd like to let users who visit the > site for the first time be able to choose a password and name. This > needs to regis

Re: SyncDB failure

2009-07-09 Thread James PIC
Hi, Apparently, this was not triggered by class names, but by verbose_name length: INSERT INTO "auth_permission" ("name", "content_type_id", "codename") VALUES (%s, %s, %s) (u"Can change cat\xe9gorie d'immobilier d'entreprise (LCP)", 44, u'change_categoriedelcp') Traceback (most recent call last

Re: Overloading ModelFormMetaclass, to implement a custom __init__() method and use ModelForm in a factory

2009-01-13 Thread James PIC
On Tue, Jan 13, 2009 at 11:57 AM, James PIC wrote: > That's what i'm actually trying to do: > > # todo : get a more descriptive FC prefix than "jpic" > class JpicModelFormMetaclass(ModelFormMetaclass): >""" >Inherit from this, then u

Overloading ModelFormMetaclass, to implement a custom __init__() method and use ModelForm in a factory

2009-01-13 Thread James PIC
Hello everybody, This snippet is working fine, i used this instead of adding custom arguments when overloading each of my ModelForm's constructore to keep the same __init__() signature. http://www.djangosnippets.org/snippets/1272/ Currently refactoring, it makes sense to use a factory in my case

Fwd: Optional fields in admin page

2008-12-21 Thread James PIC
Errata, this email has correct sources, sorry for the pollution. On Sun, Dec 21, 2008 at 4:46 PM, Mirat Can Bayrak wrote: > > hi, i have a state selection which has options "exists", "not exists" and > "redirected" when it is selected as exists i want to show some more fields, > but on other s

Re: Optional fields in admin page

2008-12-21 Thread James PIC
On Sun, Dec 21, 2008 at 4:46 PM, Mirat Can Bayrak wrote: > > hi, i have a state selection which has options "exists", "not exists" and > "redirected" when it is selected as exists i want to show some more fields, > but on other selections i dont want him to show them. can i do that it django?

Re: Restricting add in the admin

2008-12-20 Thread James PIC
On Sat, Dec 20, 2008 at 3:17 PM, Peter wrote: > > > > On Dec 20, 1:03 pm, felix wrote: >> just a thought: >> >> you might consider allowing multiple front page objects and having a way to >> select the current one. >> this could come in handy to switch what is currently the front page (or to >>

Re: SyncDB failure

2008-12-20 Thread James PIC
>> Just for kidding: >> class Lot(Mandat, Bien, PourLocation, PourVente, LotAddresse, >> AvecEquipementsAnnexes, Textes, Immeuble): >> It was that, or models with thousands of similar fields, high WTF/hour :) > > just be thankful you aren't coding in german :) It's very business-spec

Re: Restricting add in the admin

2008-12-19 Thread James PIC
On 12/19/08, Peter wrote: > > > > > > You could make such a check and deny the saving of a new FrontPage > > object by overloading the save() method of class FrontPage. > > Source in trunk: django/db/models/base.py. > > > > Regards, James. > > > Thanks James. > > Yes - I see that would wor

Re: Restricting add in the admin

2008-12-19 Thread James PIC
On 12/19/08, Peter wrote: > > I have two models in my app - one is standard in that it allows > changing existing records/instances and adding new ones. But the other > - actually a FrontPage model - does not permit adding another > instance. There are ways to do this but I am wondering if th

Re: SyncDB failure

2008-12-19 Thread James PIC
On 12/17/08, Russell Keith-Magee wrote: > > On Wed, Dec 17, 2008 at 9:30 PM, James PIC wrote: > > > > Is it worth reporting the bug? > > However, at a guess, I'm going to say that the problem has been caused > by your choice of model names. You appear to

SyncDB failure

2008-12-17 Thread James PIC
Hello everybody, Description: margaux mmm # ./manage.py syncdb Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table django_admin_log

Re: Model Meta verbose_name setter

2008-07-22 Thread James PIC
Hi Marty, On Mon, Jul 21, 2008 at 9:18 PM, Marty Alchin <[EMAIL PROTECTED]> wrote: > > On Mon, Jul 21, 2008 at 2:55 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> This is why i need to code a little mechanism to set the verbose_name >> property of Meta subclass of Model. >> I can't get it to