Changes between Version 2 and Version 3 of Ticket #28262


Ignore:
Timestamp:
06/01/2017 02:13:48 PM (4 years ago)
Author:
Tim Graham
Comment:

Correction: 8f30556329b64005d63b66859a74752a0b261315 is the commit where the regression appeared. I'm updating the description with a copy/paste version of the models/admin that I used.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28262

    • Property Severity changed from Normal to Release blocker
    • Property Summary changed from Using lookup with autocreated fields crashes django admin to ModelAdmin.lookup_allowed() incorrectly raises DisallowedModelAdminLookup lookup with reverse relation to origin model
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #28262 – Description

    v2 v3  
    22
    33{{{
    4 class AuditSession(Model):
    5     auditor = models.ForeignKey(User)
     4from django.db import models
     5from django.contrib.auth.models import User
    66
    7 class Institution(Model):
     7class AuditSession(models.Model):
     8    auditor = models.ForeignKey(User, on_delete=models.CASCADE)
     9
     10class Institution(models.Model):
    811    name = models.CharField(max_length=100)
    912
    10 class Auditor(Model):
    11     user = models.OneToOneField(User)
    12     institution = models.ForeignKey(Institution, null=True, blank=True)
     13    def __str__(self):
     14        return self.name
     15
     16class Auditor(models.Model):
     17    user = models.OneToOneField(User, on_delete=models.CASCADE)
     18    institution = models.ForeignKey(Institution, on_delete=models.CASCADE, null=True, blank=True)
    1319}}}
    1420
    1521And the following filter in audit session admin:
    1622{{{
    17 class AuditSessionAdmin(ModelAdmin):
     23from django.contrib import admin
     24
     25from .models import AuditSession, Institution, Auditor
     26
     27@admin.register(AuditSession)
     28class AuditSessionAdmin(admin.ModelAdmin):
    1829    list_filter = (
    1930        ('auditor__auditor__institution'),
    2031    )
     32
     33admin.site.register((Institution, Auditor))
    2134}}}
    2235
Back to Top