from django import forms
from .models import StudentProfile



class AddNewStudent(forms.ModelForm):
    class Meta:
        model = StudentProfile
        fields = ('firstName', 'lastName','studentId','level','department','gender',)




    def clean(self):
        cd = self.cleaned_data
        if StudentProfile.objects.filter(studentId=cd['studentId']).exists():
            raise forms.ValidationError('User exists')

a6c0f18dc47b45e268749268521746b9a0b16203
<mask token>

<mask token>


class AddNewStudent(forms.ModelForm):


    class Meta:
        model = StudentProfile
        fields = ('firstName', 'lastName', 'studentId', 'level',
            'department', 'gender')
    <mask token>

<mask token>


class AddNewStudent(forms.ModelForm):


    class Meta:
        model = StudentProfile
        fields = ('firstName', 'lastName', 'studentId', 'level',
            'department', 'gender')

    def clean(self):
        cd = self.cleaned_data
        if StudentProfile.objects.filter(studentId=cd['studentId']).exists():
            raise forms.ValidationError('User exists')

from django import forms
from .models import StudentProfile


class AddNewStudent(forms.ModelForm):


    class Meta:
        model = StudentProfile
        fields = ('firstName', 'lastName', 'studentId', 'level',
            'department', 'gender')

    def clean(self):
        cd = self.cleaned_data
        if StudentProfile.objects.filter(studentId=cd['studentId']).exists():
            raise forms.ValidationError('User exists')

from django import forms
from .models import StudentProfile



class AddNewStudent(forms.ModelForm):
    class Meta:
        model = StudentProfile
        fields = ('firstName', 'lastName','studentId','level','department','gender',)




    def clean(self):
        cd = self.cleaned_data
        if StudentProfile.objects.filter(studentId=cd['studentId']).exists():
            raise forms.ValidationError('User exists')
