Created
January 31, 2018 21:05
-
-
Save cnk/4c094894912bcdfb2ef859701b6ca6d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def site_authors(request): | |
return Author.objects.filter(site_id=request.site.id) | |
class Authorships(Orderable, models.Model): | |
author = models.ForeignKey('Author', related_name='author_paper_relationship', on_delete=models.CASCADE) | |
paper = ParentalKey('Page', related_name='paper_author_relationship', on_delete=models.CASCADE) | |
panels = [ | |
SnippetChooserPanel('author', qs_restriction=site_authors, editable=False) | |
] | |
class Meta: | |
unique_together = ["author", "paper"] | |
#### and then I need to create code that adds a permissible kwarg to SnippetChooserPanel and figure out | |
### how to have it affect the query done in wagtailsnippets/views/chooser.py#choose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment