title: Custom validation in Django admin
body: <p>I have a very simple Django app in order to record the lectures given my colleagues.Since it is quite elementary,I am using the Django admin itself. Here is my models.py:</p>
  
  <pre><code>#models.py
  from django.db import models
  
  class Lecture(models.Model):
      topic = models.CharField(max_length=100)
      speaker = models.CharField(max_length=100)
      start_date = models.DateField()
      end_date = models.DateField()
  </code></pre>
  
  <p>I need to ensure that nobody enters the start date after the end date in the admin forms,so I read the django docs for custom validation in the admin and implemented the following in my admin.py:</p>
  
  <pre><code>#admin.py
  from models import Lecture
  from django.contrib import admin
  from django import forms
  
  
  class LectureForm(forms.ModelForm):
      class Meta:
          model = Lecture
  
          def clean(self):
              start_date = self.cleaned_data.get('start_date')
              end_date = self.cleaned_data.get('end_date')
              if start_date &gt; end_date:
                  raise forms.ValidationError("Dates are incorrect")
          return self.cleaned_data
  
  
  class LectureAdmin(admin.ModelAdmin):
      form = LectureForm
      list_display = ('topic', 'speaker', 'start_date', 'end_date')
  
  admin.site.register(Lecture, LectureAdmin)
  </code></pre>
  
  <p>However,this has no effect whatsoever on my admin and I am able to save lectures where start_date is after end_date as seen in the image:<img src="https://i.stack.imgur.com/3pvc7.png" alt="enter image description here"></p>
  
  <p>What am I doing wrong ??</p>