Re: form_for_model

2009-01-30 Thread Daniel Roseman
On Jan 30, 11:44 pm, xankya wrote: > hi, I am using django.VERSION (1, 0, 2, 'final', 0). > > django.forms.form_for_model is not available in this version. can > anybody tell me what is the equivalent module name for > form_for_module ?? Create a ModelForm instead. See here: http://docs.djangopr

form_for_model

2009-01-30 Thread xankya
hi, I am using django.VERSION (1, 0, 2, 'final', 0). django.forms.form_for_model is not available in this version. can anybody tell me what is the equivalent module name for form_for_module ?? --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: NameError: name 'form_for_model' is not defined

2008-10-18 Thread [EMAIL PROTECTED]
Thanks! On Oct 18, 12:07 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, Oct 18, 2008 at 12:59 PM, [EMAIL PROTECTED] < > > > > [EMAIL PROTECTED]> wrote: > > > I am having trouble importing, 'form_for_model' > > > -I am usi

Re: NameError: name 'form_for_model' is not defined

2008-10-18 Thread Karen Tracey
On Sat, Oct 18, 2008 at 12:59 PM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > I am having trouble importing, 'form_for_model' > > -I am using Django 1.0 > -I know that newforms has been renamed to forms. > > What import statement should I use to include

NameError: name 'form_for_model' is not defined

2008-10-18 Thread [EMAIL PROTECTED]
I am having trouble importing, 'form_for_model' -I am using Django 1.0 -I know that newforms has been renamed to forms. What import statement should I use to include form_for_model? This one works on my hosting provider.. "from django.newforms import form_for_model" B

Re: File Upload with form_for_model

2008-05-22 Thread Rajesh Dhawan
On May 22, 4:11 pm, jabbercat <[EMAIL PROTECTED]> wrote: > Hello, > > I want to upload files with a Form generated by form_for_model(). The > form is ok, but I can't upload files, because I get different errors. > > I get an error, that FileForm has no attribute c

Re: File Upload with form_for_model

2008-05-22 Thread [EMAIL PROTECTED]
t; I want to upload files with a Form generated by form_for_model(). The > form is ok, but I can't upload files, because I get different errors. > > I get an error, that FileForm has no attribute cleaned_data. Knows > somebody the problem? > > Here my code

File Upload with form_for_model

2008-05-22 Thread jabbercat
Hello, I want to upload files with a Form generated by form_for_model(). The form is ok, but I can't upload files, because I get different errors. I get an error, that FileForm has no attribute cleaned_data. Knows somebody the problem? Here my code: The template: Add a

Re: form_for_model and accessing foreign object attribute

2008-04-28 Thread morfeus
Everyone, Wow! Thanks for the speedy response. I only wish I had thrown in the towel days ago and posted here. I could have saved a lot of time! Oh well, I did learn a lot. Richard, I tried to implement your solution but I get the error: 'global name 'Manager' is not defined' I tried adding an i

Re: form_for_model and accessing foreign object attribute

2008-04-28 Thread Karen Tracey
On Mon, Apr 28, 2008 at 5:20 PM, Richard Dahl <[EMAIL PROTECTED]> wrote: > > You are having trouble because the form does not contain a Manager > object, it contains the primary key of a related Manager object. > > Actually, form.cleaned_data['manager'] will be a Manager object. That's what clean

Re: form_for_model and accessing foreign object attribute

2008-04-28 Thread Richard Dahl
ssing an attribute value of a foreign object through the form. > > What I have: > A form that gathers information and upon submission adds a record to > the database and sends out an email. I am creating the form with > form_for_model. A basic version of the model is: > > class

form_for_model and accessing foreign object attribute

2008-04-28 Thread morfeus
thers information and upon submission adds a record to the database and sends out an email. I am creating the form with form_for_model. A basic version of the model is: class Software_request(models.Model): manager = models.ForeignKey(Manager) fname = models.CharField("First name"

Re: newforms: how to validate form_for_model ?

2007-11-07 Thread Thomas Guettler
Am Mittwoch, 7. November 2007 12:02 schrieb parabol: > Hi, > I have a form class which is generated with form_for_model. How can I > write my custom validator? I think I should set a clean() method for > that class. Is it reasonable to say that; > > fom1.clean= def clean

newforms: how to validate form_for_model ?

2007-11-07 Thread parabol
Hi, I have a form class which is generated with form_for_model. How can I write my custom validator? I think I should set a clean() method for that class. Is it reasonable to say that; fom1.clean= def clean fkoksal --~--~-~--~~~---~--~~ You received this

Re: questions about form_for_model

2007-10-12 Thread Chris Brand
msoulier wrote: > I am using Django stable (0.96). > > When I use form_for_model on a model that includes CharFields that > have choices attributes, the resulting form field is not a ChoiceField > as specified in the documentation. Is this simply a bug in 0.96? > > I think

questions about form_for_model

2007-10-12 Thread msoulier
I am using Django stable (0.96). When I use form_for_model on a model that includes CharFields that have choices attributes, the resulting form field is not a ChoiceField as specified in the documentation. Is this simply a bug in 0.96? Also, if I wish to return a different field type, not based

Re: form_for_model should return TextareaWidget

2007-10-11 Thread Malcolm Tredinnick
On Thu, 2007-10-11 at 08:46 +0200, Thomas Guettler wrote: > Am Mittwoch, 10. Oktober 2007 15:09 schrieb Malcolm Tredinnick: > > On Wed, 2007-10-10 at 14:51 +0200, Thomas Guettler wrote: > > > Hi, > > > > > > How can I get a TextareaWidget with form_for_model()

Re: form_for_model should return TextareaWidget

2007-10-10 Thread Thomas Guettler
Am Mittwoch, 10. Oktober 2007 15:09 schrieb Malcolm Tredinnick: > On Wed, 2007-10-10 at 14:51 +0200, Thomas Guettler wrote: > > Hi, > > > > How can I get a TextareaWidget with form_for_model()? > > > > I have a solution, but it is too much code. You need to creat

Re: form_for_model should return TextareaWidget

2007-10-10 Thread Malcolm Tredinnick
On Wed, 2007-10-10 at 09:09 -0400, Malcolm Tredinnick wrote: > On Wed, 2007-10-10 at 14:51 +0200, Thomas Guettler wrote: > > Hi, > > > > How can I get a TextareaWidget with form_for_model()? > > > > I have a solution, but it is too much code. You need to creat

Re: form_for_model should return TextareaWidget

2007-10-10 Thread Malcolm Tredinnick
On Wed, 2007-10-10 at 14:51 +0200, Thomas Guettler wrote: > Hi, > > How can I get a TextareaWidget with form_for_model()? > > I have a solution, but it is too much code. You need to create > an own DB-Field. Right there, as you realise, you're looking the right place. Yo

form_for_model should return TextareaWidget

2007-10-10 Thread Thomas Guettler
Hi, How can I get a TextareaWidget with form_for_model()? I have a solution, but it is too much code. You need to create an own DB-Field. Is there a better solution? models.py: text=dbfields.TextareaField(max_length=128, rows=4, cols=40, verbose_name="Text", blank=True) d

form_for_model admin like add on ForeignKey

2007-08-23 Thread D3f0
Hi! Sorry if my question is nonsense, I'm not experienced with Django, this is my first real app. I'm trying to reproduce the admin interfase in a form that I build with form_for_model(), well, not *all* the admin interfase, but the editing part, in particular, the widgets that it

Re: form_for_model with custom modifications and save()

2007-07-20 Thread ilDave
Ok, I resolved just adding a 'codice' key with the right value to the f.clean_data dict before saving... Is there a better way or can I stay with this? On Jul 20, 4:35 pm, ilDave <[EMAIL PROTECTED]> wrote: > Hello! > I'm using form_for_model to create a form for a

form_for_model with custom modifications and save()

2007-07-20 Thread ilDave
Hello! I'm using form_for_model to create a form for a particulary complex model. I don't want to show a particular field of the model in the form, so I did this: PreventivoForm = form_for_model(Preventivo) #Preventivo is the name of the model del PreventivoForm.base_fields['co

form_for_model and limit_choices_to

2007-07-15 Thread Birkin James Diana
I've created a newforms form using form_for_model(). The problem I'm having is that two fields are not respecting part of the field definition in the model; I'm hoping I'm overlooking something. The end result I want is for a scanner select-menu to show only scanners,

Re: Filtering foreignkey results with newforms form_for_model

2007-07-06 Thread [EMAIL PROTECTED]
mething like > > EventFormClass.base_fields['club'].widget = > widgets.Select(choices=[(club.id, str(club)) for club in > Club.objects.filter(approved=True)] > > Also, it's often a good idea to *not* try to shoeh

Re: Filtering foreignkey results with newforms form_for_model

2007-07-06 Thread James Bennett
ood idea to *not* try to shoehorn things into form_form_model... usually it's quicker to write a custom form which does what you want than to add/remove things from form_for_model. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~

Re: Filtering foreignkey results with newforms form_for_model

2007-07-06 Thread [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote: > I have an "Event" model that has a foreignkey relationship with > "Club", and I'm using form_for_model to create the form. This spits > out all "Club" entries in a dropdown. > > The trick is, "Club" has a bo

Filtering foreignkey results with newforms form_for_model

2007-07-05 Thread [EMAIL PROTECTED]
I have an "Event" model that has a foreignkey relationship with "Club", and I'm using form_for_model to create the form. This spits out all "Club" entries in a dropdown. The trick is, "Club" has a boolean field for "approved", and I want

Re: newforms form_for_model defaults by model

2007-06-14 Thread Iapain
an change the formfield > > callback but the model doesn't impact that function in any way by > > default. What I'm looking for is a way for a model to define the form/ > > field relationships so form_for_model will return a custom form class > &g

Re: newforms form_for_model defaults by model

2007-06-14 Thread handsome greg
y for a model to define the form/ > field relationships so form_for_model will return a custom form class > for the model without me having to know anything about it. Is this in > newforms at all? --~--~-~--~~~---~--~~ You received this message because you are subscri

newforms form_for_model defaults by model

2007-06-14 Thread handsome greg
or is a way for a model to define the form/ field relationships so form_for_model will return a custom form class for the model without me having to know anything about it. Is this in newforms at all? --~--~-~--~~~---~--~~ You received this message because you ar

Re: form_for_model + FileField issue

2007-06-12 Thread Vincent Nijs
Malcolm, I wasn't very clear in my question. Sorry about that. It took a bit of trial and error but I found a hack that works the way I want it to. I use the model and form_for_model/form_for_instance for all fields except the file uploads. For the file uploads I use FileInput(). That was

Re: form_for_model + FileField issue

2007-06-12 Thread Malcolm Tredinnick
On Tue, 2007-06-12 at 20:03 -0500, Vincent Nijs wrote: > Thanks for the reply Malcolm. > > That is too bad. I noticed that the FileFields do have a browse button in > the admin form btw. Do they not use form_for_model? > > As an alternative, is there a way to use FileField

Re: form_for_model + FileField issue

2007-06-12 Thread Vincent Nijs
Thanks for the reply Malcolm. That is too bad. I noticed that the FileFields do have a browse button in the admin form btw. Do they not use form_for_model? As an alternative, is there a way to use FileField 's separately from the the form_for_model fields? I am thinking I could leav

Re: form_for_model + FileField issue

2007-06-12 Thread Malcolm Tredinnick
On Tue, 2007-06-12 at 18:50 -0500, Vincent Nijs wrote: > Hi, > > I have a form linked to a model. I am using form_for_model or > form_for_instance as required. > > The only issue is that FileField fields are not displayed with a 'browse' > button. The function I

form_for_model + FileField issue

2007-06-12 Thread Vincent Nijs
Hi, I have a form linked to a model. I am using form_for_model or form_for_instance as required. The only issue is that FileField fields are not displayed with a 'browse' button. The function I am using is given below. I know from the documentation that model fields get convert

Re: form_for_model, custom save(), and saving excluded fields?

2007-06-07 Thread John M
= form_for_model(Holding, form=HoldingForm) form = modelform() else: instance = Holding.objects.get(id__exact=holdid) modelform = form_for_instance(instance, form=HoldingForm) form = modelform(instance.__dict__) if request.POST: form = modelform(request.POST

Re: form_for_model, custom save(), and saving excluded fields?

2007-06-06 Thread ringemup
> I'd suggest ditching form_for_model and writing a custom form; it's > extremely easy to do that (as opposed to trying to shoehorn things > into form_for_model), and really any time you need customized behavior > you should be tailoring a form exactly to suit; anything els

Re: form_for_model, custom save(), and saving excluded fields?

2007-06-06 Thread James Bennett
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > If I've got a form_for_model but I've excluded some fields from it > entirely (because I don't want people to be able to find the values in > hidden fields, or even try to submit them), how do I set values back > f

form_for_model, custom save(), and saving excluded fields?

2007-06-06 Thread ringemup
Yes, another newforms question If I've got a form_for_model but I've excluded some fields from it entirely (because I don't want people to be able to find the values in hidden fields, or even try to submit them), how do I set values back for those fields before saving the da

Re: form_for_model, DecimalFIeld, and decimal_places

2007-06-05 Thread ringemup
OK, I wasn't really sure how to do this correctly, but I just filed ticket #4486 ( http://code.djangoproject.com/ticket/4486 ) -- hopefully in a useful form! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django u

Re: form_for_model, DecimalFIeld, and decimal_places

2007-06-05 Thread Russell Keith-Magee
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > > > 1) This sounds like it could be a bug. If your model defines 2 decimal > > places, my initial reaction is that the form should show 2 decimal > > places by default. > > Well, I figured that with currency being such a common use, if it were > a b

Re: form_for_model, DecimalFIeld, and decimal_places

2007-06-05 Thread ringemup
hed. But maybe what I'm doing is unusual -- I'm feeding the field an initial value of 25.00, and the form is displaying "25.0" > 2) You can override an individual element using the formfield_callback > on form_for_model. The idea here is to provide a function that returns &g

Re: form_for_model, DecimalFIeld, and decimal_places

2007-06-05 Thread Russell Keith-Magee
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > > Hello again -- > > I'm creating a form using form_for_model. The model in question has a > decimal field with 2 decimal places. The form, however, is displaying > the field with one decimal place. I've goo

form_for_model, DecimalFIeld, and decimal_places

2007-06-05 Thread ringemup
Hello again -- I'm creating a form using form_for_model. The model in question has a decimal field with 2 decimal places. The form, however, is displaying the field with one decimal place. I've googled and poked through the tests, but I can't figure out how to override this w

Re: change help_text if form_for_model used...

2007-05-25 Thread Jens Diemer
Jens Diemer schrieb: > How can i change the help_text after i have generate the form with > form_for_model() ? I found a solution: -- from django.contrib.auth.models import User UserForm = forms.form_for_model(User,

Re: change help_text if form_for_model used...

2007-05-25 Thread Malcolm Tredinnick
On Fri, 2007-05-25 at 10:02 +0200, Jens Diemer wrote: > > How can i change the help_text after i have generate the form with > form_for_model() ? At some point you shouldn't be afraid to read the relevant code in newforms, since it is very well commented and answers to questions

change help_text if form_for_model used...

2007-05-25 Thread Jens Diemer
How can i change the help_text after i have generate the form with form_for_model() ? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

newforms, form_for_model, and FilePathField

2007-05-04 Thread James
Hi, Quite new to both Django and python. I'm trying to create a form using form_for_model with a model that has a FilePathField as one of it's attributes. The documentation for FilePathField states that the path parameter is the "absolute filesystem path to a directory

subclassing form_for_model

2007-05-04 Thread Sean Mc Allister
Hi, can somebody give me a hint how to subclass a form_for_model class? I have read ticket 3815, but that doesn't seem to work too well for me. If I simply subclass the Form, the new fields aren't added if I subclass with argument form=newforms.Form only the new fields are there (see

form_for_model, unique=True

2007-04-23 Thread Dmitry Mukhin
Hi, Should form_for_model respect model's field 'unique=True' constraint? It doesn't now (5061). Or I should attach clean_xxx methods to the form myself? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: form_for_model and hidden foreign key?

2007-02-24 Thread sandro.dentella
I'm not sure is you're talking about UPDATE or INSERT. Clearly when INSERTing new record it's easy to just setdefaults. The problem arises when UPDATEing. If my tests are correct (I'm pretty convinced tey are...) in fact you need to put all fields you don't want to update as hidden fields, and tha

Re: form_for_model and hidden foreign key?

2007-02-22 Thread dballanc
def CustomUser_callback(field, **kwargs): display_fields = ('firstname', 'lastname', 'email', 'phone') if field.name in display_fields: return field.formfield(**kwargs) else: return None After looking at the django source, I realized that the 'f' was for field, not for

form_for_model and hidden foreign key?

2007-02-21 Thread dballanc
ral required foreign keys. I need to have a form that only displays a subset of the model fields, and the required keys are not in this subset! That leads to problems with trying to save the form generated by form_for_model(). class CustomUser(model.Models) client = models.For

cant get date js thingie using form_for_model

2007-02-21 Thread Kenneth Gonsalves
hi i was using form_for_model and it worked great - only thing, I didnt get the fancy date entry js thingie like in admin. What do I need to do to get that? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web

Re: Newforms, form_for_model, help_text and unicode.

2007-02-19 Thread Adrian Holovaty
On 2/19/07, sandro.dentella <[EMAIL PROTECTED]> wrote: > I had similar problems this night. It comes out help_text is the > source of problems. I fixed it adding smart_unicode in Field class > (newforms.fields): > > class Field(object): > ... > def __init__(...): > self.help_text = s

Re: Newforms, form_for_model, help_text and unicode.

2007-02-19 Thread sandro.dentella
Hi, I had similar problems this night. It comes out help_text is the source of problems. I fixed it adding smart_unicode in Field class (newforms.fields): class Field(object): ... def __init__(...): self.help_text = smart_unicode(help_text) sandro *:-) PS: should I open a ticket

Newforms, form_for_model, help_text and unicode.

2007-02-12 Thread Michel Thadeu Sabchuk
Hi guys, I have my database and my application set up to the UTF-8 charset (my settings file have an option DEFAULT_CHARSET = 'UTF-8'). I don't have to pass verbose_names or help_texts as unicode strings, I didn't have any problem with character encoding using the admin interface, but now I want

Re: form_for_model and default values

2007-02-07 Thread HenrikG
On 11 Jan, 04:07, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > 2) I have a model with aUserfield so what I do (on the view) is the > following: > > Entry.fields['autor'].widget = forms.HiddenInput() > > if request.user.is_authenticated(): > Entry.fields['autor'].initial = (

form_for_model and default values

2007-01-10 Thread [EMAIL PROTECTED]
Hi everybody, I'm newbie at django but I think is awesome. I use newforms and I had two questions: 1) I have a model with a FileField so everything at the admin interface works fine, but when I get the form using form_for_model the widget isn't a FileInput(). Is this the right beh

form_for_model and default values

2007-01-09 Thread Rodrigo Lazo
Hi everybody, I'm newbie at django but I think is awesome. I use newforms and I had two questions: 1) I have a model with a FileField so everything at the admin interface works fine, but when I get the form using form_for_model the widget isn't a FileInput(). Is this the right beh