You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1017 B
Python
34 lines
1017 B
Python
from django.forms import ModelForm, TextInput
|
|
from django.urls import reverse_lazy
|
|
|
|
from preinfo.models import Preinfo
|
|
|
|
|
|
class PreinfoBaseForm(ModelForm):
|
|
class Meta:
|
|
model = Preinfo
|
|
fields = '__all__'
|
|
widgets = {
|
|
'container_number': TextInput(attrs={
|
|
'oninput': 'validateContainerNumber(this)',
|
|
'class': 'form-control'
|
|
})
|
|
}
|
|
# success_url = reverse_lazy('client_preinfo')
|
|
class PreinfoCreateForm(PreinfoBaseForm):
|
|
"""
|
|
Form for creating a new PreinfoModel instance.
|
|
Inherits from PreinfoBaseForm.
|
|
"""
|
|
class Meta(PreinfoBaseForm.Meta):
|
|
exclude = ['created_on',
|
|
'created_by',
|
|
'deleted',
|
|
'deleted_on',
|
|
'deleted_by',
|
|
'received'] # Exclude fields that should not be set by the user
|
|
|
|
|
|
class PreinfoEditForm(PreinfoBaseForm):
|
|
class Meta:
|
|
fields = ['container_number', 'container_type', 'line'] |