moved some validation from settings page to form.

This commit is contained in:
ajurna committed 2015-07-24 10:22:24 +01:00
1 parent f3d2a9e6ac
commit 744710e7d3
2 files changed
+23 -15

No files matched your search

+9
View File
@@ -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')