Django multi-select widget?
The Django admin site makes use of a really cool widget: How can I make use of this widget in my own applications? I don't see anything like that listed here. ...
The Django admin site makes use of a really cool widget: How can I make use of this widget in my own applications? I don't see anything like that listed here. ...
I'm having a bit of difficulty understanding how the python __init__( ) function works. What I'm trying to do is create a new form in django, and use the uni_form helper to display the form in a custom manner using fieldsets, however I'm passing an argument to the form that should slightly change the layout of the form and I can't figure...
Hello all, First I'll lay out what I'm trying to achieve in case there's a different way to go about it! I want to be able to edit both sides of an M2M relationship (preferably on the admin page although if needs be it could be on a normal page) using any of the multi select interfaces. The problem obviously comes with the reverse sid...
Hello I am currently working on a django project, in one of my Models I have a file upload and image upload, with the parameters of these two fields both are set to blank=True, however there is a stipulatation with this and it is that field can only be blank if one of the two is not, so for example, if the imagefield is complete then the...
Has anyone had any joy/pain with using other form libraries in django projects (with SQLAlchemy models initially, but perhaps to use with django models in future)? Initial impressions are that sprox is more flexible and decoupled but that formalchemy might be quicker to get up and running with, but I'd be really interested in hearing fr...
I am trying to add multiple inline form items to a page using Djangos ModelForms. I need Select boxes bound to database models. The forms are formatted and placed in a tabular format so I need to display only the ModelForm without ANY surrounding HTML. class LeagueForm(ModelForm): league = forms.ModelChoiceField(queryset=League.objects....
I've been stuck on this likely very simple problem, but haven't gotten anywhere with it (newbie to Python and Django). I'm taking some user submitted data and using weights to calculate a score. Despite my best efforts, I'm getting the following when I submit the data via a form: "global name 'appearance' is not defined". I'm pretty s...
I am a complete beginner trying to build an inventory app in Django by copying examples. There are two models of interest, a item record and a name record. The item has a primary key - the manufacturer's serial number (an 11 character mix of letters and numbers) and an inventory tag (charField of 20 chars or less - which could be blank)....
If think my question is pretty obvious and almost every developer working with UserProfile should be able to answer it. However, I could not find any help on the django documentation or in the Django Book. When you want to do a UserProfile form in with Django Forms, you'd like to modify the profile fields as well as some User field. B...
Hi, I have this simple form: class PagoDesde(forms.Form): from django import forms as f desde = f.DateField(input_formats=['%d/%m/%Y']) In my template: {{ form.desde }} And has associated a jqueryui.datepicker in the document.ready $("#id_desde").datepicker(); The html result is: <input type="text" id="id_desde"...
Hi, in my Django application I've got a form with a ChoiceField that normally allows to choice between a range of integer values. class FormNumber(forms.Form): list=[] for i in range(1, 11): list.append((i,i)) number=forms.ChoiceField(choices=list, initial=1) Now I need to override the default choices list from a view method in some ...
Whenever you use a {{ form.field.errors }} tag in a Django template, the validation message that is displayed is always surrounded with a unordered list tag. This is not ideal for me. Am I able to modify the surrounding validation message html for a form from a reusable package? ...
What I'm trying to do I'm going to be keeping data about competitions in my database. I want to be able to search the competitions by certain criteria - competition type in particular. About competition types Competition types are kept in a tuple. A slightly shortened example: COMPETITION_TYPE_CHOICES = ( (1, 'Olympic Games'), ...
This is my form on models.py class ItemForm(forms.Form): itemname = forms.CharField(max_length=100) itemwording = forms.CharField(max_length=100) notes = forms.CharField() abundance = forms.IntegerField(max_value=10) collunit = forms.CharField(max_length=50) litref = forms.CharField(max_length=100) litkey = ...
I want to create a field for phone number input that has 2 text fields (size 3, 3, and 4 respectively) with the common "(" ")" "-" delimiters. Below is my code for the field and the widget, I'm getting the following error when trying to iterate the fields in my form during initial rendering (it happens when the for loop gets to my phone...
There are a lot of complex forms in my project and I keep getting the feeling that I could be coding them much more elegantly and simply. So my question is what are some good apps and practices that might help me? Specifically, I'm thinking about situations when I need to do stuff like: edit/add more than one object via one form (examp...
I've created a simple contact form using the modelformset_factory to build the form in the view using the DB model. The issue that I am having is that the is_valid() check before the save() is not working. When I submit the form with empty fields it still passes the is_valid() and attempts to write to the DB. I would like the is_vali...
I'm iterating through the fields of a form and for certain fields I want a slightly different layout, requiring altered HTML. To do this accurately, I just need to know the widget type. It's class name or something similar. In standard python, this is easy! field.field.widget.__class__.__name__ Unfortunately, you're not allowed access ...
Scenario: I'm building an order-form. Like every other order-form on the planet, it has separate invoicing shipping addresses. I've just added a "Use billing address" checkbox to let the user save time. The problem is, the shipping fields are still there. They will fail validation if the user don't enter any shipping address data (like ...
I have a "Villa" Model with lots of descriptive TextFields. For each TextField, I have a copy which will be the Russian translation of the original field, which I'm naming by appending "_ru", for example "long_description" and "long_description_ru". I would like to exclude all the "_ru" fields from my ModelForm, which I thought I would b...