import os

from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.utils.translation import gettext_lazy as _
from bigsansar.contrib.sites.models import domains, pages
from www.settings import BASE_DIR


class create_domainform(forms.ModelForm):
    domain = forms.CharField(max_length=100, min_length=3, validators=[
        RegexValidator('^[a-z0-9.]+\.[a-z0-9]{1,5}$', message='Please enter your correct domain name')],
                             widget=forms.TextInput(attrs={'autofocus': True, 'class': 'form-control', }))

    class Meta:
        model = domains
        fields = ('domain', 'Description', 'user',)