django-forms

Get previously entered information in Django FormWizard

I'm trying to create a simple Django multi-page form using FormWizard. What the form should do is the following: Let the visitor enter first and lastname in a form. Continue to next page where entered previously firstname and lastname will be displayed, there will also be a field on this page that let's the visitor enter a message. The...

Django re-orden form fields?

Hi guys, i have a form, but i need to re-orden the form fields, plese some body will tell me how? im try with fields = ['x','y'] but nothing happen. class DiligenciaForm(ModelForm): titulo = forms.CharField(max_length=70,help_text='Dele un nombre a su diligencia.') tipo = forms.ChoiceField(choices=TIPO) vias= forms.TypedCh...

django + jquery + and dynamic form , fields sent empty

Hi, i dont know how ill say this, but i have a Form, in this form im trying to add some fields with jquery (dynamic??) clicking a radio button, so , when im trying the send the data , django said that the fields are empty ... and in the debuger (error pages??) is tru, the fields are empty, but the fields from my Form.py they not. im new...

how validate form and show the value of the filled fields?

Hi guys, now im learning to validate form, "all" is working, im showing the erros of empty fields, but i have 2 questions: how ill show the value in the filled fields when there are errors in another fields?, like <input ... value= {{ value }} > the problem is that my fields are not html forms fields. how ill show the error exactly ove...

Django validate and go back to preview URL ?

Hi guys, im asking again :), i don't know how make this. My English is not too good, but ill try to asking this: how ill validate a form and go back to the preview url (the same view form) and show the validation errors?, im asking this because i have 2 form's, the first form's action is going to a second form (POST), but in this secon...

How do you dynamically hide form fields in Django?

I am making a profile form in Django. There are a lot of optional extra profile fields but I would only like to show two at a time. How do I hide or remove the fields I do not wan to show dynamically? Here is what I have so far: class UserProfileForm(forms.ModelForm): extra_fields = ('field1', 'field2', 'field3') extra_field_t...

Django WizardForm and second form will be "dynamic"

Hi guys, i have 2 day's thinking how make this. I have two forms (really 4), the first form have radio buttons, where the second form will be different if the user choice x radio button option. Like alway's sorry with my English. ill explain : First Form have an options with radio buttons, with the options ill bring the "called form...

django , how insert a register for every input text?

Hi guys, i want to know how ill insert (save in database) a register (one) for every input text that i have in a form? I have a form with 4 input text, so i need for every input create a new register in the database. Maybe Django have something for this? Please and Thanks :) regards, Asinox ...

Loading and saving data from m2m relationships in Textarea widgets with ModelForm

I have a Model that looks something like this: class Business(models.Model): name = models.CharField('business name', max_length=100) # ... some other fields emails = models.ManyToManyField(Email, null=True) phone_numbers = models.ManyToManyField(PhoneNumber, null=True) urls = models.ManyToManyField(URL, null=True) ...

Django, login form in home pages and others?

Hi guys, i want to know how ill show the Form Login in the home pages and others? Thanks guys :) ...

Django ModelForm CheckBox Widget

I'm currently have an issue, and likely overlooking something very trivial. I have a field in my model that should allow for multiple choices via a checkbox form (it doesn't have to be a checkbox in the admin screen, just in the form area that the end-user will see). Currently I have the field setup like so: # Type of Media MEDIA_CHOICE...

InlineFormSet with queryset of different model

What we're trying to do is populate a list of inline forms with initial values using some queryset of a different model. We have products, metrics (some category or type or rating), and a rating, which stores the actual rating and ties metrics to products. class Product(models.Model): name = models.CharField(max_length=100) pric...

Controlling Django ModelForm output

I've got a Model in Django, example code below (not my actual code): class Department(models.Model): name = models.CharField(max_length=100) abbreviation = models.CharField(max_length=4) Let's say I do the following in the Django shell: >>> Department(name='Computer Science',abbreviation='C S ').save() >>> Department(name='Ma...

How do you render a django form in a view?

for field in FIELDS: row = [] row.append("<tr>") row.append("<td>" + str(myform.fields.get(field)) + "</td>") row.append("</tr>") custom_fields.append("".join(row)) When I give the custom_fields variable to the template, all I'm getting is: <tr><td><django.forms.widgets.CheckboxInput object at 0x1fa7d90></td></tr>...

Django : get entries of today and SplitDateTime Widget ?!

hello I used : SplitDateTimeWidget to split DateTime field , appointment = forms.DateTimeField(widget=forms.SplitDateTimeWidget) In the template side i manage to use datePicker and TimePicker for each field , using jQuery . When i try to filter the entries regarding to today date as in this code : d = datetime.date.today() entries...

Is this a bug in Django formset validation?

Manual example: http://docs.djangoproject.com/en/1.0/topics/forms/formsets/#formset-validation (I'm using Django 1.0.3 to run on Google App Engine) Code: from django import forms from django.forms.formsets import formset_factory class ArticleForm1(forms.Form): title = forms.CharField() pub_date = forms.DateField() class ArticleFo...

Models duplicating on save instead of updating

I'm trying to make a Django application to handle events. The view below handles the editing of already created events. @login_required def event_admin(request, event_id): event = get_object_or_404(Event, pk=event_id) if request.method == 'POST' and request.user == event.organiser: event_form = EventAdminForm(request.PO...

Dynamic Dropdown list with actions

like 1 image says more than 1000 words. here is what I want to implement in a django webapp: http://bit.ly/1ocI0X Is a dynamic dropdown list with an action to add values to db and dynamicly added to self dropdownlist. Any hint would be appreciated. Tks. ...

Django, ModelChoiceField() and initial value

Hi guys, im using something like this: field1 = forms.ModelChoiceField(queryset=...) Now how ill show selected x value from the database? thanks ...

Customizing how a form outputs a field to a widget in django

I have a custom field called HourField, which lets you enter "1:30" to represent one and a half hours. The clean() method turns it into 1.5 for the FloatField in the model. This all works fine. Now I'm having a problem where when I want to create a formset, that field gets rendered as "1.5" instead of "1:30" which is what I want. Is the...