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
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
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
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
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
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
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
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
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
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
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
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"
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
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
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
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
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()
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
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
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
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
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
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
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
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,
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
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."
--~--~-~--~
<[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
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
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
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
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
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
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
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
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
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
= 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
> 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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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 = (
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
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
62 matches
Mail list logo