Hi.  I don't see anything in your code samples that would cause this.   One 
line in admin.py caused the server to stop because of the extra 
parenthesis, and the default for status should be 'r' instead of  
'refereed', but those don't cause the problem you're describing.  Maybe a 
browser issue?  Maybe there's something with a custom widget that isn't the 
samples?

On Monday, September 13, 2021 at 9:13:48 AM UTC-4 nine...@gmail.com wrote:

> Hi,
> 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.
>
> My code is:
>
> *Models.py*
> """"
> 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.py*
> """
> @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.
>
> Thanks in advance,
> Maria
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3cc17c27-7c78-4f60-8a59-894711f182a1n%40googlegroups.com.

Reply via email to