Re: Dynamic model field

2008-12-27 Thread sergioh
Maybe a better approach for this, can be override the save method for your model and also exclude that field on your forms. Actually there is a post from James Bennett at: http://www.b-list.org/weblog/2008/dec/24/admin/ hope it helps, regards, Sergio Hinojosa On Dec 26, 6:32 pm, eldonp2

Re: Help regarding Sqlite3

2008-11-06 Thread sergioh
Also you can use the python shell, you can import your models and create objects, the you can save them and also make queries to your model. is simple as: # manage.py shell >>> from django.contrib.auth.models import User >>>User.objects.all() .. Also the structure of the tables created

Re: TemplateDoesNotExist

2008-11-13 Thread sergioh
are you using fastcgi? it could be an error on your syspath? On Nov 13, 3:57 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-11-12 at 23:05 -0800, [EMAIL PROTECTED] wrote: > > Sorry about the inconsistency but just to be clear, here is what I > > have: > > > Dreamhost

Re: Overriding contrib.auth User save()

2008-11-26 Thread sergioh
Signals are the better way to achieve. You usually override the save method when you need to define something related with the model itself, but in many cases signals are the better way to notify some function to do something if a model change (after save) def your_function(sender, instance,

Re: Sending automatic emails

2008-11-27 Thread sergioh
On Nov 27, 9:28 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On Friday 28 November 2008 06:46:57 am izzy wrote: > > > I'm just curious if its possible in django to send automatic emails > > based on the data in the database? > > what do you mean by 'automatic emails"? Do you mean emails at

Re: Overriding contrib.auth User save()

2008-11-27 Thread sergioh
f, username, email, password) > > UserManager.create_user = my_create_user > > # et voilà. > > > Paddy > > > On Nov 27, 12:39 am, sergioh <[EMAIL PROTECTED]> wrote: > > > > Signals are the better way to achieve. You usually override the save > > >

Re: ModelForm question

2008-11-27 Thread sergioh
On Nov 26, 4:25 pm, fiedzia <[EMAIL PROTECTED]> wrote: > Hi > > I am trying to achieve the following effect: > > A ModelForm containing list of choices and input to possibly add > another > element to the list is presented on page. > If user will not choose any item from list and will type

Re: Help organizing inline fields in User

2008-11-28 Thread sergioh
You could use field sets to get your information organized: fieldsets = ( ('Account Information', { 'fields':('company_name', 'username', 'password', 'email', 'is_active')}), ('Company Information',{'fields': ('physical_address', 'city', 'state', 'zip_code',

Re: Overriding contrib.auth User save()

2008-11-28 Thread sergioh
On Nov 28, 8:02 am, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 28 nov, 09:45, Paddy Joy <[EMAIL PROTECTED]> wrote: > > > Thanks however I'm guessing: > > > > admin.site.unregister(User) > > > admin.site.register(User, NewModelForm) > > > will only work in the admin site? > > Yes.

Re: sql used in the save method

2008-11-28 Thread sergioh
There is On Nov 28, 8:05 am, Robert <[EMAIL PROTECTED]> wrote: > Hello !! > > I am using mysql as the backend and trying to use insert delayed of a > query (http://dev.mysql.com/doc/refman/5.0/en/insert-delayed.html), to > do this I have to change a bit the insert statement, and I want to > know

Re: Form Widget Attributes

2008-11-28 Thread sergioh
Probably you will need to create your custom widget and override the method: def id_for_label(self, id_): # See the comment for RadioSelect.id_for_label() if id_: id_ += '_0' return id_ id_for_label = classmethod(id_for_label) at the checkboxmultiple

Re: Overriding contrib.auth User save()

2008-11-28 Thread sergioh
(.): self.create(...#user fields and your new custom fields#) self.set_password('222') self.save() On Nov 28, 9:39 am, sergioh <[EMAIL PROTECTED]> wrote: > On Nov 28, 8:02 am, bruno desthuilliers > > <[EMAIL PROTECTED]> wro

Re: Admin - Auto Generate user_id on save

2008-11-30 Thread sergioh
On Nov 29, 8:26 pm, AJ <[EMAIL PROTECTED]> wrote: > James, > > Thanks for the reply, I can't tell you how many times I read over that > page in the documentation today, and didn't catch that.  I think when > this problem arose I looked over the ModelForm docs and couldn't find > a solution.  

Re: Local flavor and admin (zip-code)

2008-12-02 Thread sergioh
On Dec 1, 11:14 am, Fabio Natali <[EMAIL PROTECTED]> wrote: > Hi everybody! > > I'm having difficulties while trying to insert a zip-code field in one > of my models. I'd like to rely upon some italian local flavor stuff, > so to get some validation for free. > > Here comes my models.py: > >

Re: Customizing ModelForm fields appearance

2008-12-23 Thread sergioh
You can always add your own custom fields, by default they override the default fields that becomes with the modelform, and there is an optional parameter "attributes", which is used to add css class to your fields. On Dec 23, 9:47 am, sagi s wrote: > I really like the concept

How to set defaults['empty_permitted'] = False in a BaseFormSet

2008-12-23 Thread sergioh
Hi, I would like to find a straightforward way to get the defaults ['empty_permitted'] = False in a BaseFormSet to True, which means that all forms in a formset should be not empty by default. Thanks in advance, Sergio Hinojosa --~--~-~--~~~---~--~~ You received

Re: javascript

2008-09-19 Thread sergioh
Maybe an easy way for qa env you could add something like: (r'^scripts/(.*)', 'django.views.static.serve', {'document_root':'jscripts/'}), to your urls.py of your project. And in your template: This will looks for jquery.js inside the jscript directory (yourproject/jscripts/lib/..) On Sep