mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 14:17:19 +00:00
moved some validation from settings page to form.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from os import path
|
||||
|
||||
from comic.models import Setting
|
||||
|
||||
|
||||
@@ -174,6 +177,12 @@ class SettingsForm(forms.Form):
|
||||
}
|
||||
))
|
||||
|
||||
def clean_base_dir(self):
|
||||
data = self.cleaned_data['base_dir']
|
||||
if not path.isdir(data):
|
||||
raise forms.ValidationError('This is not a valid Directory')
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def get_initial_values():
|
||||
base_dir, created = Setting.objects.get_or_create(name='BASE_DIR')
|
||||
|
||||
Reference in New Issue
Block a user