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.
 
 
 
 
 

19 lines
553 B

from django import forms
from finapp.models import PayAllTimeGateway
class PayAllTimeGatewayForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
instance = getattr(self, 'instance')
if instance and instance.pk:
self.fields['slug'].disabled = True
def clean_slug(self):
if self.instance and self.instance.pk:
return self.instance.slug
return self.data['slug']
class Meta:
model = PayAllTimeGateway
fields = '__all__'