You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
759 B

from django import forms
from common.models import Location
from .models import WorkSell
class WorkSellForm(forms.ModelForm):
class Meta:
model = WorkSell
fields = '__all__'
widgets = {
'construction_type': forms.Select(attrs={'class':'selectpicker'}),
'building_classification': forms.Select(attrs={'class':'selectpicker'}),
'currency': forms.Select(attrs={'class':'selectpicker'}),
'term_type': forms.Select(attrs={'class':'selectpicker'}),
}
def __init__(self, *args, **kwargs):
# self.request = kwargs.pop('request')
super().__init__(*args, **kwargs)
self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()