--
Ticket URL: <https://code.djangoproject.com/ticket/25537>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "Select Menu item to change - Django site admin.png" added.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Could you please add more details such as a sample project so we can
reproduce the issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:1>
Comment (by yaniv14):
First I had this in my models.py
{{{
#!python
class MenuTime(models.Model):
title = models.CharField(_('Title'), max_length=200)
order = models.PositiveSmallIntegerField(_('Order'), default=1)
class Meta:
verbose_name = _('Menu time')
verbose_name_plural = _('Menu times')
ordering = ['order', ]
def __unicode__(self):
return self.title
class MenuGroup(models.Model):
title = models.CharField(_('Title'), max_length=200)
class Meta:
verbose_name = _('Menu group')
verbose_name_plural = _('Menu groups')
def __unicode__(self):
return self.title
class HealthQuestionnaire(models.Model):
title = models.CharField(_('Name'), max_length=200)
class Meta:
verbose_name = _('Health questionnaire')
verbose_name_plural = _('Health questionnaires')
def __unicode__(self):
return self.title
class MenuItem(models.Model):
name = models.CharField(_('Name'), max_length=200)
time = models.ManyToManyField(MenuTime, related_name='menu_items')
group = models.ForeignKey(MenuGroup, related_name='menu_items')
male = models.BooleanField(_('For male?'), default=True)
female = models.BooleanField(_('For female?'), default=True)
image = ImageField(upload_to='menus', verbose_name=_("Menu image"),
blank=True, null=True)
not_allowed = models.ManyToManyField(HealthQuestionnaire,
verbose_name=_("Not allowed with"),
related_name='menu_items',
blank=True)
class Meta:
verbose_name = _('Menu item')
verbose_name_plural = _('Menu items')
ordering = ['-name']
def __unicode__(self):
return self.name
def admin_thumbnail(self):
return u'<img src="%s" width="120" height="auto" />' %
self.image.url if self.image else None
admin_thumbnail.short_description = _('Thumbnail')
admin_thumbnail.allow_tags = True
def not_allowed_list(self):
return ", ".join([x.title for x in self.not_allowed.all()])
not_allowed_list.short_description = _('Not allowed list')
}}}
And I had 11 MenuItem objects created from django admin, later I decided
to change the relation of time field from M2M to ForeignKey -> "time =
models.ForeignKey(MenuTime, related_name='menu_items', null=True)"
I ran manage.py makemigration and migrate and then I've started to notice
the issue.
All 11 objects are still accessible and the bug I have is only in the
django admin list display.
If i am adding to the url the object ID
(127.0.0.1:8000/admin14/core/menuitem/2/) I am able to see the correct
object in the admin panel.
Hope it helps to reproduce the bug
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:2>
Comment (by timgraham):
I can't reproduce the issue. Maybe the issue is caused by certain data
you've created. Can you be more specific with the minimal steps to
reproduce it or provide a SQLite database that demonstrates the issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:3>
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:4>
Comment (by yaniv14):
I already wrote the steps that I did.
I cannot attach the sqlite db file because I already modified that file
and it will not show the bug any more.
This is just a project in early stages of development.
I will try to reproduce this bug again in the future.
If you want to close the ticket or leave it open for now its up to you.
Thank you
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:5>
Comment (by collinanderson):
Usually if the rows don't show up that means there's an error that's
getting silenced somewhere. Scale back (or disable) your `list_display`
and try to figure out which column is causing the error.
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:6>
* status: new => closed
* resolution: => worksforme
--
Ticket URL: <https://code.djangoproject.com/ticket/25537#comment:7>