#22015 closed Bug (worksforme)

Hide relationships with related_name='+' in contrib.admindocs

Reported by: motiejus Owned by: gregchapple
Component: contrib.admindocs Version: master
Severity: Normal Keywords: nlsprint14
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX: yes

Description

If related_name of a ForeignKey/M2M relationship is '+', user explicitly asked Django to not create backwards relation. This should be taken into account when rendering admindocs.

Pull request: https://github.com/django/django/pull/2263

Change History (8)

comment:1 Changed 19 months ago by timo

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 19 months ago by timo

  • Summary changed from Hide relationships with related_name='+' to Hide relationships with related_name='+' in contrib.admindocs

As noted on the PR, admindocs is severely lacking in tests and bootstrapping them enough to be able to write a test for this change is more work than the reporter wants to do. If anyone else is interested in this patch, the first step will be to do that.

comment:3 Changed 19 months ago by claudep

Note that there are also tests in tests/admin_docs, notably admin_docs.tests.AdminDocViewTests.test_model_detail. We'd need a new models.py, though.

comment:4 Changed 19 months ago by gregchapple

  • Owner changed from nobody to gregchapple
  • Status changed from new to assigned

comment:5 Changed 19 months ago by gregchapple

  • Keywords nlsprint14 added

comment:6 Changed 19 months ago by gregchapple

Added tests which cover django.contrib.admindocs.views.ModelDetailView which was seriously lacking in test coverage. This is part of ticket #22015, though the original issue for which the ticket was opened, seems to be already working as expected, with and without this patch. Though this patch does contain a test which covers the issue raised in the ticket, and should catch it in the future should it re-arise.

Pull request: https://github.com/django/django/pull/2364

I will do some further investigation into the original issue, and update again with my findings.

comment:7 Changed 19 months ago by Baptiste Mispelon <bmispelon@…>

In b1d10205ce0c4bb355e20bed6258b5264ed06cc5:

Added tests for django.contrib.admindocs

Refs #22015

comment:8 Changed 19 months ago by bmispelon

  • Resolution set to worksforme
  • Status changed from assigned to closed

As mentionned by gregchapple, this appears to have already been fixed so I'll close this ticket as worksforme.

Please reopen if you can provided steps that reproduce your issue.

Thanks.

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