I have a django form that takes the year and month as integers, and uses these inputs to add the concatenated value (year-month) to a charfield called date:
'date': str(form.cleaned_data['year']) + '-' + str(form.cleaned_data['month'])
django model:
year = models.IntegerField()
month = models.IntegerField()
date = models.CharField(max_length=30)
the issue, as shown in the chart below, 2021-12 is being treated as smaller than 2021-4. How can I create a django date field that only takes month and year as inputs and can have the result being showed in the right ascending order, 2021-4 then 2021-12 OR in the form of 2021, April then 2021, December.
