class EducationCreate(CreateView):
    model = Education
    form_class = EducationForm

    def form_valid(self, form):
        form.instance.student = self.request.user
        return super(EducationCreate, self).form_valid(form)

    def dispatch(self, *args, **kwargs):
        return super(EducationCreate, self).dispatch(*args, **kwargs)
url(r'^settings/education/add/$', views.EducationCreate.as_view(), 
class Education(models.Model):
    student = models.ForeignKey(settings.AUTH_USER_MODEL)
    school = models.CharField(max_length=250)
    started = models.DateField()
    finished = models.DateField()
    degree = models.CharField(max_length=250)
class EducationForm(forms.ModelForm):
    school = forms.CharField(label="School 
Name",max_length=250,help_text="Please enter the school name.")
    started = forms.DateField(label="Started School",)
    finished = forms.DateField(label="Finished School",)
    degree = forms.CharField(label="Degree Earned",max_length=250, 
help_text="Please enter the degree earned.")
    class Meta:
        model = Education
        fields = ('student','school','started','finished','degree')

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to