Created
          June 18, 2013 16:13 
        
      - 
      
- 
        Save julianwachholz/5806721 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
    
  
  
    
  | class ImageQuerysetMixin(object): | |
| """ | |
| Make sure to use the correct arguments for getting a single image. | |
| With this mixin it's not possible to request an image just by its | |
| primary key, we'll also need the correct username. | |
| """ | |
| def get_queryset(self): | |
| return self.model.objects.filter( | |
| pk=self.kwargs.get('pk', None), | |
| user__username=self.kwargs.get('user', None) | |
| ) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment