I'm very new in Django. I'm making a cv, but I don't get select a choice through the django-admin web. I've searched solutions in the community but I cant't solve it.
class Article(models.Model):
year = models.PositiveIntegerField(
validators=[
MinValueValidator(1900),
MaxValueValidator(datetime.now().year)], null=True, blank=True)
title = models.CharField(max_length=200)
author = models.ManyToManyField(Author)
journal = models.ForeignKey(Journal, models.CASCADE)
summary = models.TextField(max_length=1000, null=True, blank=True,
help_text="Brief description of the article")
PUB_TYPE = (
('r', 'refereed'),
('t', 'technical report'),
('p', 'proceeding'),
('b', 'book'),
('c', 'book chapter'),
)
status = models.CharField(max_length=1, choices=PUB_TYPE, default='refereed',
help_text='publication type')
class Meta:
ordering = ['year']
def get_absolute_url(self):
return reverse('article-detail', args=[str(
self.id)])
def __str__(self):
return self.title
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'journal', 'year', 'status')
list_filter = (("year", "journal")
ordering = ('-year',)
search_fields= ('author',)
filter_horizontal = ('author',)
raw_id_fields = ('journal',)
When I click in the status button (attached image), the choices aren't displayed and i can't seletc one.
I would be very grateful for any idea.