How to give select images option in django model forms ?

2021-03-14 Thread Kumar Gaurav
Hii Everyone, I have a Model Form, one field is to upload image. Right now , user can select images from their system and upload but I want to give a certain number of images as a dropdown option (showing the images in preview) to select from. How can I implement this ?? and the best solution

Re: Model Forms Dynamic

2019-05-28 Thread Alexis Roda
Something like that? def model_form_factory(model_class): class MyModelForm(forms.ModelForm): class Meta: model = model_class return MyModelForm AuthorForm = model_form_factory(Author) BookForm = model_form_factory(Book) Missatge de Yoo del dia dt., 28 de maig 2019

Model Forms Dynamic

2019-05-28 Thread Yoo
https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/ In the example of model form, they say model = Author Is it possible to set a variable to set the model? Like could I make a variable and set it to whatever model I’d like, then say model = var? -- You received this message because

Re: Django Model Forms.

2019-05-17 Thread Alex Kimeu
Thanks. Makes sense. Let me try it. Thanks. On Fri, 17 May 2019, 14:18 Joe Reitman, wrote: > In your template you can identify each field by its name and use a table > to render them in columns. e.g. > > table > table row > table data {{ form.username }} > table data {{ form.password }

Re: Django Model Forms.

2019-05-17 Thread Joe Reitman
In your template you can identify each field by its name and use a table to render them in columns. e.g. table table row table data {{ form.username }} table data {{ form.password }} On Friday, May 17, 2019 at 2:23:14 AM UTC-5, kimeualexis wrote: > > Hello, guys. > Is there a way to la

Django Model Forms.

2019-05-17 Thread kimeualexis
Hello, guys. Is there a way to lay out Django Model form fields across the Browser rather than top-down? Kindly assist. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an e

Re: how can I work with multi model forms

2018-12-27 Thread Danny Blaker
https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#inline-formsets https://github.com/elo80ka/django-dynamic-formset/blob/master/docs/usage.rst https://github.com/elo80ka/django-dynamic-formset/blob/master/INSTALL.rst clone the above, then check the examples On Wednesday, 26 Decem

Re: how can I work with multi model forms

2018-12-27 Thread Ira Abbott
Hi, Model forms have one model. To have the form update fields in other models, you can overload form_valid in views so that it writes the addition form field to their respective models. Ira Sent from my iPhone > On Dec 26, 2018, at 9:45 AM, Nur Mohsin wrote: > > Hi, in views.py

Re: how can I work with multi model forms

2018-12-26 Thread Nur Mohsin
Hi, in views.py form.save() is commented. Remove comment and try again. Then, tell us what happens? On Wed, Dec 26, 2018 at 6:29 PM Tessnim Zrayga wrote: > Hello everyone, > I have this design: there's a firm, a firm can have multiple nodes. Each > node can have many scheduled actions. What I'm

how can I work with multi model forms

2018-12-26 Thread Tessnim Zrayga
Hello everyone, I have this design: there's a firm, a firm can have multiple nodes. Each node can have many scheduled actions. What I'm trying to do is to create a template containing all informations about a firm and be able to create multiple scheduled actions at a time, so this is what the te

Re: Django multiple Model Forms in template

2018-06-23 Thread martin . ma012500
Hi. I have changed views.py last line to this: return render(request, 'assumptions.html', {'formset': formset,'model_names': model_names,'name': name}) As a result, it outputted more forms, however they do not save to model forms to database and raise V

Re: Django multiple Model Forms in template

2018-06-23 Thread alex eckert
rk a little better. I've found formsets to be very frustrating so I hope you manage to do better than me! On Friday, June 22, 2018 at 7:19:28 PM UTC-5, martin@gmail.com wrote: > > It would be highly appreciated if you could advise how the template should > be modified to

Re: Model forms

2017-01-24 Thread Vijay Khemlani
T-02:00 JJEMBA KENNETH : > >> Hello Django user, >> Am a new user and am worndering How can I add a css class to django >> model >> forms, like bootstrap classes >> >> -- >> Jjemba Kenneth >> >> -- >> You received this message beca

Re: Model forms

2017-01-24 Thread Fred Chevitarese
com* <http://chevitarese.wordpress.com> 2017-01-24 11:06 GMT-02:00 JJEMBA KENNETH : > Hello Django user, > Am a new user and am worndering How can I add a css class to django model > forms, like bootstrap classes > > -- > Jjemba Kenneth > > -- > You received thi

Model forms

2017-01-24 Thread JJEMBA KENNETH
Hello Django user, Am a new user and am worndering How can I add a css class to django model forms, like bootstrap classes -- Jjemba Kenneth -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Suggestions on autocomplete solutions for non-model forms not in the admin

2014-09-29 Thread Collin Anderson
It might be simplest to write all your own code. It could be easier to debug and you'll have full control of the situation. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send a

Suggestions on autocomplete solutions for non-model forms not in the admin

2014-09-26 Thread Tiago Almeida
Hi, I'd like to implement an autocomplete functionality for a text field that is defined via a normal form class (forms.Form, not a ModelForm) and rendered automatically via cryspy-forms (although this is not a requirement). Autocomplete suggestions should have some kind of template (not simply

Re: There's any package to integrate jquery validation in my model forms?

2014-05-01 Thread Venkatraman S
On Fri, May 2, 2014 at 5:47 AM, Fellipe Henrique wrote: > There's any package to integrate jquery validation in my model forms? > > A side note : crispy-forms and parsley does most of the lifting w.r.t forms for me. -- You received this message because you are subscribed to the

There's any package to integrate jquery validation in my model forms?

2014-05-01 Thread Fellipe Henrique
There's any package to integrate jquery validation in my model forms? Cheers! T.·.F.·.A.·. S+F *Fellipe Henrique P. Soares* e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge' *Blog: http://fhbash.wordpress.com/ <http://fhbash.

Re: django model forms validation and error display

2011-11-01 Thread Kurtis Mullins
I recommend using Class Based Views if you're running Django 1.3. I tried to go over your app and re-create a prototype using CBVs. I didn't spend a lot of time on the actual logic or field types. I also didn't even try running this. You'll need to fill in a couple of blanks but hopefully you get t

django model forms validation and error display

2011-11-01 Thread luke lukes
i have this template: http://dpaste.com/645468/ that send data to this view: http://dpaste.com/645469/. the template display a form made by modelforms, with a custom layout. i have to validate the fields value send to view, and then redirect to the same template if the field validation fails. i've

can you use the Form Wizard with Model Forms?

2011-07-13 Thread sq1020
d the user submitted data is added to the database. I took a look at the docs for the Form Wizard and it seems like it would work for model forms as well? Can someone confirm this? And if it does, can someone explain the process of creating a WizardView class. This example is given in the docs

Re: Getting Django admin to display new autoincremented values in primary key model forms

2011-05-06 Thread wilbur
With my current setup, the autoincrement variable set in postgresql is visible in the Django admin as "Sample_ID", with an empty form field. The user can't possibly know what the next value in the sequence should be, so I'm wondering how to deal with the field, as it is Not NULL, and any attempt to

Re: Getting Django admin to display new autoincremented values in primary key model forms

2011-05-04 Thread pjrhar...@gmail.com
Hi, See this ticket for details on the error you are seeing: http://south.aeracode.org/ticket/407 If I understand correctly, it sounds like you're asking for something that isn't possible anyway. The id isn't known until the item is inserted into the database, because the database assigns the i

Getting Django admin to display new autoincremented values in primary key model forms

2011-05-04 Thread wilbur
I am using Django 1.2.4 with a Postgresql 8.4 backend. Before creating my models in Django, I began with a existing Postgresql database with tables for which I had defined integer primary keys that used an autoincrementing sequence on table inserts. When I created my Django models, I defined the pr

Re: multi model forms

2011-03-01 Thread Pete
Yeah, I bet that lastname is required=True (which is default). You probably want to redefine lastname to avoid that. On Mar 1, 5:25 am, David De La Harpe Golden wrote: > On 28/02/11 23:13, django wrote: > > > hi guys > > I am new to django. > > > I have got two model User(Django built in ) and a

Re: multi model forms

2011-03-01 Thread David De La Harpe Golden
On 28/02/11 23:13, django wrote: > hi guys > I am new to django. > > I have got two model User(Django built in ) and a model customer, user > is foreign key in customer > > class Customer(models.Model): > user = models.ForeignKey(User, related_name='customers') > street = models.CharField(max

multi model forms

2011-02-28 Thread django
hi guys I am new to django. I have got two model User(Django built in ) and a model customer, user is foreign key in customer class Customer(models.Model): user = models.ForeignKey(User, related_name='customers') street = models.CharField(max_length=200) city = models.CharField(max_length=1

unique_together validation passes on model forms that exclude unique fields

2011-02-16 Thread Lior Sion
Hi, I have a model with a unique_together field set. I also have a form for that model that excludes one field - but I still need the uniqueness to stay. Example: class A(models.Model): name = models.CharField(max_length=30) friend = models.ForeignKey(Friend) and the form: class AForm

Re: Model Forms Customization

2011-02-03 Thread hank23
in the case of Django, is > actually enjoyable) is a Good Thing. > > On Jan 31, 7:37 pm, hank23 wrote: > > > > > I think I've read most of the documentation on Model Forms, but I > > haven't seen much on how to customize them, other than changing the > >

Re: Model Forms Customization

2011-02-02 Thread Derek
e documentation on Model Forms, but I > haven't seen much on how to customize them, other than changing the > order in which fields are displayed, or not displaying some fields at > all. The one ModelForm which I've done so far does not look very good > as it is automatically gen

Model Forms Customization

2011-01-31 Thread hank23
I think I've read most of the documentation on Model Forms, but I haven't seen much on how to customize them, other than changing the order in which fields are displayed, or not displaying some fields at all. The one ModelForm which I've done so far does not look very good as it i

Re: get id to be used in a foreign key with two model forms

2010-12-23 Thread Michael Thamm
ote: > Hi, > I am using 2 model forms and when I save the I get a save error since > the foreign key field can't be blank. > I try to add the new id at save, but it doesn't work. > This is the code for the save. > > temp=shirtForm.save(commit=False) >            

get id to be used in a foreign key with two model forms

2010-12-22 Thread Michael Thamm
Hi, I am using 2 model forms and when I save the I get a save error since the foreign key field can't be blank. I try to add the new id at save, but it doesn't work. This is the code for the save. temp=shirtForm.save(commit=False) userForm.shirt=temp.id use

model forms/formset poor performance

2010-10-25 Thread SlafS
Hi there! I'm developing a small django app with some models and modelformsets. Using Django Debug-Toolbar I noticed the overhead (in my particular case) which Django makes by performing extra queries to validate a form in a formset http://dpaste.com/hold/263886/ I know that this is needed in ma

Re: Nesting model forms with admin

2010-05-03 Thread Matt Schinckel
On May 3, 8:23 am, Spaceman Paul wrote: > I can't find the ticket, Matt.  If you could forward me a link, or > just > dig that patch up for me, I'd greatly appreciate it. http://code.djangoproject.com/ticket/9025 I haven't looked at this much since November, so it may not be that useful. Matt.

Re: Nesting model forms with admin

2010-05-02 Thread Spaceman Paul
I can't find the ticket, Matt. If you could forward me a link, or just dig that patch up for me, I'd greatly appreciate it. Paul. On May 2, 8:41 pm, Matt Schinckel wrote: > I have a patch: it was a while ago, but I was about to dig it up > again. > > In the meantime, there is an open ticket - I

Re: Nesting model forms with admin

2010-05-02 Thread Matt Schinckel
I have a patch: it was a while ago, but I was about to dig it up again. In the meantime, there is an open ticket - I think my patch is attached. Matt On Apr 20, 10:49 am, Spaceman Paul wrote: > I'm looking at extending the django admin app for a project, as it > does about 96% of what we need s

Nesting model forms with admin

2010-04-19 Thread Spaceman Paul
I'm looking at extending the django admin app for a project, as it does about 96% of what we need straight out of the box. The main feature not offered is what might be called nested modelforms. Stretching the example from the InlineModelAdmin documentation (which does almost the exact opposite o

Re: Model Forms

2009-08-27 Thread Siddharth Godbole
Yup It worked! I saved the form with excluded foreign key with commit=False. Then set the proper instance to foreign key and then saved. It worked just fine. Thanks for the help :) On Thu, Aug 27, 2009 at 10:47 PM, Shawn Milochik wrote: > > There are different options, depending on whether the i

Re: Model Forms

2009-08-27 Thread Shawn Milochik
There are different options, depending on whether the instance of B is a required part of A's model. 1. You can add an "exclude" section to your ModelForm of A. Validate BForm, validate AForm, then take the resulting instance of A and set it's 'b' attribute to the resulting instance of BFor

Model Forms

2009-08-27 Thread Sid
I have 2 models say A and B, B has A has a foreign key reference to A. There is a model form created for mode B called as BForm. Now If i create instance of BForm and display it in a page, foreign key field appears as a drop down choice box in the form. Instead of this if i set instance of B to BF

Re: Problem with Model Forms and Reverse Many-to-Many Relationships

2009-06-01 Thread Jashugan
Here's my workaround, if anyone else is interested how to overcome this problem: http://www.pastie.org/497309 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Problem with Model Forms and Reverse Many-to-Many Relationships

2009-06-01 Thread Jashugan
How do you create a model form that contains a reverse many-to-many relationship? My attempt: http://pastie.org/497284 failed: AttributeError: 'RelatedObject' object has no attribute 'unique' --~--~-~--~~~---~--~~ You received this message because you are subs

pyjamas django model/forms integration

2009-03-09 Thread lkcl
i note that there is interest in GWT Django Models / Forms integration, which is something presently being experimented on in pyjamas by some of the users. following on from this: http://groups.google.com/group/django-users/browse_thread/thread/87035bc2fa95930d/a25d10638ed6f809?lnk=gst&q=pyjamas#

Combining Model Forms

2009-03-05 Thread Andy Wilson
all, I'd like to find a way to combine two model forms (ie., modelForm subclasses). I understand that there's no way I can do this so that the resulting form is somehow bound to both models at the same time - all i need is that the resulting HTML form contains input fields corres

Re: Problems with file upload and model forms

2008-11-21 Thread Marc Barranco
Oh yeah!! It was that! Thank you veru much Alex :) I forgot to put the template code, Here it is (mayb useful for some other): --upload.html-- {% for field in form %} {{ field.label_tag }} {{ field }}

Re: Problems with file upload and model forms

2008-11-20 Thread Alex Koshelev
Do you use `enctype` attribute[1] of form tag? [1]: http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form On Thu, Nov 20, 2008 at 16:59, Marc Barranco <[EMAIL PROTECTED]> wrote: > > Hi! > I'm trying to upload a file like the example in documentation in > Django (h

Problems with file upload and model forms

2008-11-20 Thread Marc Barranco
Hi! I'm trying to upload a file like the example in documentation in Django (http://docs.djangoproject.com/en/dev/topics/http/file- uploads/) with the "Forms from Models". But I can't upload the file because the form always return the error "this field is required" although selecting a file before

Model Forms and Form Wizards

2008-09-04 Thread nss350
A couple of questions about forms. If I have a model form for a model which has a ManyToMany Relationship with itself, can filter the choices that will appear in the multiple choice field that will be created i.e. if I users can befriend each other, how can I remove from the choices users who ar

Re: Get and set encryption in Model Forms

2008-08-18 Thread simong
On Aug 11, 1:42 am, jonknee <[EMAIL PROTECTED]> wrote: > On Aug 10, 11:29 am, simong <[EMAIL PROTECTED]> wrote: > > > The code executes correctly and writes the record to the database but > > doesn't encrypt the credit card number. > > You're not following the snippet you linked to, the view code