2017-05-16 16:13:35 +02:00
|
|
|
from dal import autocomplete
|
|
|
|
|
2017-05-09 00:00:26 +02:00
|
|
|
from django.forms import ModelForm
|
2019-06-07 15:03:29 +02:00
|
|
|
from django.urls import reverse_lazy
|
2017-05-09 00:00:26 +02:00
|
|
|
|
|
|
|
from roms.models import Rom
|
|
|
|
|
|
|
|
|
2017-05-16 16:13:35 +02:00
|
|
|
|
|
|
|
class RomCreateForm(ModelForm):
|
2017-05-09 00:00:26 +02:00
|
|
|
class Meta:
|
|
|
|
model = Rom
|
|
|
|
fields = ['name', 'description', 'cover', 'low_binary', 'high_binary', 'tags']
|
2017-05-16 16:13:35 +02:00
|
|
|
|
|
|
|
widgets = {
|
|
|
|
'tags': autocomplete.TaggitSelect2(reverse_lazy('tag-autocomplete'))
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RomUpdateForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Rom
|
|
|
|
fields = ['description', 'cover', 'low_binary', 'high_binary', 'tags']
|
|
|
|
|
|
|
|
widgets = {
|
|
|
|
'tags': autocomplete.TaggitSelect2(reverse_lazy('tag-autocomplete'))
|
|
|
|
}
|