Changes between Initial Version and Version 1 of Ticket #31083


Ignore:
Timestamp:
Dec 12, 2019, 7:57:16 AM (5 years ago)
Author:
Kris Ciccarello
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31083 – Description

    initial v1  
    33Given this class:
    44
    5 ```
     5{{{
    66from django.contrib.sites.models import Site
    77
     
    1010        Site, on_delete=models.CASCADE, primary_key=True, related_name="detail"
    1111    )
    12 ```
     12}}}
     13
     14
    1315
    1416The following does not work:
    1517
    16 ```
     18{{{
    1719Site.objects.select_related("detail").get_current(request)
    1820> AttributeError: 'QuerySet' object has no attribute 'get_current'
    19 ```
     21}}}
    2022
    2123We could add support for something like this:
    2224
    23 ```
     25{{{
    2426Site.objects.get_current(request, select_related=["detail"])
    25 ```
     27}}}
    2628
    2729Which would allow the user to pass through any custom `Site` extensions without having to re-write the code in the `Site` manager. Given the use of `SITE_CACHE` inside of `SiteManager`, it seems like making this addition to its API would be a good step.
Back to Top