I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?
I'm trying to do it in my __init__, but it throws an error saying that "'RegistrationFormTOS' object has no attribute 'email'". Does anyone know how I can ...
Is it possible to override the html naming of fields in TabularInline admin forms so they won't contain dashes?
I'm trying to apply the knowledge obtained here to create a TabularInline admin form that has the auto-complete feature.
It all works except that Django insists in naming the fields in a tabularinline queryset as something in...
In Django / Pinax, I've come across the login form which starts like this :
<form class="login" method="POST" action="">
It works perfectly well. So I assume that either some java-script or something in the Django framework is putting the value into the action attribute. So my questions ;
a) How does Django insert the action?
b) Wh...
class MyUserAdminForm(forms.ModelForm):
class Meta:
model = Users
group = forms.ModelMultipleChoiceField(
queryset=Groups.objects.filter(domain__user=3),
widget=forms.CheckboxSelectMultiple,
)
class UserAdmin(admin.ModelAdmin):
list_display = ('login', 'company', 'userType')
form = MyUserAdminForm
filter_horizontal = ('group',)
a...
Is there some way to make the following possible, or should it be done elsewhere?
class JobRecordForm(forms.ModelForm):
supervisor = forms.ModelChoiceField(
queryset = User.objects.filter(groups__name='Supervisors'),
widget = forms.RadioSelect,
initial = request.user # is there some way to make t...
I am adding custom validation to my forms and custom fields in my Django app. I would like to be able to modify the value of a field when triggering an error. For example, if there is an error, the form should be redisplayed with the field value corrected by clean() and an error message "Data has been corrected below. Click save again to...
I have a few complex GUI elements (like a custom calendar with many days that can be highlighted) that appear along with standard django form input fields. I want to process the data I/O from these complex forms along with the Django forms.
Previously I would use AJAX requests to process these custom GUI elements on my HTML form after ...
So I have a model with a ManyToManyField called tournaments. I have a ModelForm with two tournament fields:
pay_tourns = forms.ModelMultipleChoiceField(
queryset=Tourn.objects.all().active().pay_tourns(),
widget=forms.CheckboxSelectMultiple())
rep_tourns = forms.ModelMultipleChoiceField(
...
The challenge, output a radio select in nested <ul></ul>, grouped by the task fk.
ie.
class Category(models.Model):
# ...
class Task(models.Model):
# ...
category = models.ForeignKey(Category)
# ...
forms.py
class ActivityForm(forms.ModelForm):
# ...
task = forms.ModelChoiceField(
queryset = Task....
Hi there! My eval syntax isn't right. Namely, for each category, I'd like to output a ModelChoiceField named category_task, ie. if category were 'fun', then a radio select field
'fun_tasks' would be output.
categories = Category.objects.all()
for category in categories:
eval(category)_tasks = form.ModelChoiceField(
queryse...
I'm trying to use the admin datepicker in my own django forms.
Roughly following the discussion here : http://www.mail-archive.com/[email protected]/msg72138.html
I've
a) In my forms.py included the line
from django.contrib.admin import widgets
b) and used the widget like this :
date = forms.DateTimeField(widget=widget...
Given a set of typical models:
# Application A
from django.db import models
class TypicalModelA(models.Model):
the_date = models.DateField()
# Application B
from django.db import models
class TypicalModelB(models.Model):
another_date = models.DateField()
...
How might one change the default widget for all DateFields to a cu...
This is a follow-up on How do you change the default widget for all Django date fields in a ModelForm?.
Suppose you have a very large number of models (e.g. A-ZZZ) that is growing with the input of other developers that are beyond your control, and you want to change the way all date fields are entered (i.e. by using jQueryUI). What's t...
Have 2 tables Domain and Group having one to many relationship.
These tables have many to many relationship with User table
On the User admin interface I am rendering the Group and Domain as CheckboxSelectMultiple
widgets.
Is it possible to present this in a table form with 2 columns: Domain in one column and the list of groups belong...
I'm using MySQL
my table model :
class Offer(models.Model):
...
additional=models.CharField('Dodatkowe informacje',max_length="100",choices=ADDITIONAL_CHOICES.items(),blank=True)
...
my form:
class OfferForm(forms.ModelForm):
additional=forms.MultipleChoiceField(label='dodatkowe informacje',choices=ADDITIONAL_CHOICES....
Basically I want to have an editable form for related entries instead of a static listing.
...
Some of the forms represent parent objects and I want most field disabled in each of these forms, if they're for a 'parent' object. Is there an easy way to do this?
...
I'm certain I'm doing something really obviously stupid, but I've been trying to figure it out for a few hours now and nothing is jumping out at me.
I'm using a ModelForm so I can expose a few fields from a model for editing. 2x ImageField, 1x TextField. The Form is processed and the TextField works. The two ImageFields do not work and ...
I've seen some similar questions, but nothing that quite pointed me in the direction I was hoping for. I have a situation where I have a standard django form built off of a model. This form has a drop down box where you select an item you want to post a comment on. Now I'd like people to be able to browse by items, and click a link to co...
I have a model with field:
class Movie(models.Model):
genre = models.CommaSeparatedIntegerField(max_length=100, choices=GENRE_CHOICES, blank=True, default=0)
lang = models.CommaSeparatedIntegerField(max_length=100, choices=LANG_CHOICES, blank=True, default=0)
And I need to get multiple select fields (not checkboxes) from that....