SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from django.conf import settings
  2. from django import forms
  3.  
  4.  
  5. class Category(MPTTModel):
  6.     class Meta:
  7.         verbose_name_plural = "Categories"
  8.  
  9.     name = models.CharField(max_length=100)
  10.  
  11.     def clean_name(self):
  12.         import sys
  13.         sys.exit()
  14.         name = self.cleaned_data["name"]
  15.         if settings.PK_PLACEHOLDER in name:
  16.             raise forms.ValidationError(f"{settings.PK_PLACEHOLDER} "
  17.                                           "is a reserved placeholder!")
  18.         return name
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top