Re: django-admin doesn't display choices and it's not possible to select one

2021-09-22 Thread Mariangeles Mendoza
Hi,

Eureka!!! 
Benjamin, you are right. I changed my browser and it worked.

Thank for you advice.

Best wishes,
Maria

On Tuesday, September 21, 2021 at 9:41:18 AM UTC+2 Mariangeles Mendoza 
wrote:

> Thank you very much!!!
>
> I will try other browsers. I have used Firefox and Brave.
> No, I am not using other custom widget.
>
> Thanks again,
> Maria 
>
> On Monday, September 20, 2021 at 1:59:25 PM UTC+2 bnmng wrote:
>
>> 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/61e348de-660e-4cdd-bf39-ef14d839198bn%40googlegroups.com.


Re: django-admin doesn't display choices and it's not possible to select one

2021-09-21 Thread Mariangeles Mendoza
Thank you very much!!!

I will try other browsers. I have used Firefox and Brave.
No, I am not using other custom widget.

Thanks again,
Maria 

On Monday, September 20, 2021 at 1:59:25 PM UTC+2 bnmng wrote:

> 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/08bb4225-200e-4c1f-bfca-09c2b05fa9c5n%40googlegroups.com.


django-admin doesn't display choices and it's not possible to select one

2021-09-13 Thread Mariangeles Mendoza
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/30490e97-5c14-436b-970e-17676ad0d420n%40googlegroups.com.