Opened 7 years ago

Closed 7 years ago

#16153 closed Bug (worksforme) ignores some models when registering...

Reported by: jake.logemann@… Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:


In my for an app (called I import all of the models and list them, or try to at least. Log will display on the Admin page while BankAccount wont. I've restarted the dev server, tried deleting the .pyc file. Im out of ideas. Im using the most basic form of that I can, but I've tried defining the class and it doesnt help.

from apps.buildings.models import *

class LogAdmin(admin.ModelAdmin):
  list_display = ('building', 'title', 'body', 'logged_at')
  list_display_links = ('title',)
  list_filter = ('logged_at', 'visibility')
  search_fields = ['building'],          LogAdmin)

Log is viewable in the admin area, bank accounts are not.
Here are the models...

from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

from import *

    (0,     u'Admin-Only'),
    (1,     u'Owner-Only'),
    (2,     u'Managers'),
    (3,     u'Employees'),
    (4,     u'Public'),
class Log(models.Model):
  building = models.ForeignKey(Building, related_name='log_building')
  title = models.CharField(max_length=255, verbose_name="Job Title")
  body = models.CharField(max_length=255, verbose_name="Job Title")
  visibility = models.IntegerField(choices=VISI_LOG_CHOICES)
  logged_at = models.DateTimeField( default = )

  def __unicode__(self):
    return self.title   

class BankAccount(models.Model):
  nickname = models.CharField( max_length = 50, blank = True )
  rate = models.DecimalField( max_digits = 6, decimal_places = 4, default='0.0000' )
  balance  = models.DecimalField( 
                                 max_digits = 19, 
                                 decimal_places = 2, 
                                 default = '0.00'
Seems like a bug to me! Maybe my eyes are tired.

Change History (1)

comment:1 Changed 7 years ago by Julien Phalip

Resolution: worksforme
Status: newclosed

I can't reproduce this problem given the code you've provided. I suspect it could be because the user doesn't have the proper User Permission. Or there might also be something weird caused by the "import *" -- try importing specifically the models that you need and see whether that fixes it. In any case, it is not apparent that there is a bug in Django. You may reopen this ticket if you can provide a reproducible test case, otherwise you should ask for help on django-users.

Note: See TracTickets for help on using tickets.
Back to Top