mirror of
https://github.com/Labelbase/Labelbase.git
synced 2026-08-19 13:18:23 +02:00
.
This commit is contained in:
parent
a9fa9f0f8c
commit
39686b5807
1 changed files with 11 additions and 4 deletions
|
|
@ -1,9 +1,16 @@
|
|||
|
||||
from django.forms import ModelForm
|
||||
from django import forms
|
||||
from .models import Label, Labelbase
|
||||
|
||||
from .models import Label
|
||||
|
||||
class LabelForm(ModelForm):
|
||||
class LabelForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Label
|
||||
fields = ['labelbase', 'type', 'ref', 'label']
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.request = kwargs.pop('request')
|
||||
super(LabelForm, self).__init__(*args, **kwargs)
|
||||
self.fields['labelbase'] = forms.ModelChoiceField(
|
||||
queryset=Labelbase.objects.filter(user_id=request.user.id),
|
||||
required=True,
|
||||
widget=forms.Select(attrs={'class': 'chzn-select'}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue