title: How to get year from date field(MySQL Database) and display it in a calendar view django?
body: <p>I want to get year from date field(MySQL Database) and display it in a calendar view as per the below image:</p>
  <p><a href="https://i.stack.imgur.com/h6Fg9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h6Fg9.png" alt="enter image description here" /></a></p>
  <p>Given below is my model class:</p>
  <pre><code>YEAR_CHOICES = []
  for r in range(1980, (datetime.datetime.now().year+1)):
      YEAR_CHOICES.append((r,r))
      
  class Persons(models.Model): 
       
      id = models.IntegerField(primary_key=True)
      firstname = models.CharField(max_length=100)
      lastname = models.CharField(max_length=100)
      address = models.CharField(max_length=100)
      dob = models.CharField(max_length=100)
      salary = models.IntegerField
      doj = models.DateField(choices=YEAR_CHOICES, default=datetime.datetime.now().year)
      class Meta:
          db_table = &quot;test&quot;
  </code></pre>
  <p>Instead of only year I am getting data like &quot;Oct. 7, 2021&quot;. I want only year neither month or date.
  And display it in a calender view, like the above image.</p>
  <p>Here the year values are retrieved from the mysql database.</p>
  <p>Any help will be highly appreciated!<br />
  Thank You!!</p>