# Path: authors/models.py
# class Organization(models.Model):
#     """A group of people under a single name."""
# 
#     name = models.CharField(max_length=64)
# 
#     def __str__(self):
#         return self.name


from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MaxValueValidator
from sorl.thumbnail import get_thumbnail
from authors.models import Organization



class Media(models.Model):
    """A piece of content which has a main component and may have associated
    Authors and a caption."""

    caption = models.TextField(blank=True)

    @property
    def credit(self):
        """Forces child classes to define a "credit" attribute."""

        raise NotImplementedError('Models which inherit from this class must '
                                  'define a "credit" attribute which is a '
                                  'ManyToManyField of authors.Author.')

    def is_courtesy(self):
        """Checks if this Media is courtesy of another organization.

        Returns True if any of the Authors of the Media is not a member of
        this organization."""


# Path: authors/models.py
# class Organization(models.Model):
#     """A group of people under a single name."""
# 
#     name = models.CharField(max_length=64)
# 
#     def __str__(self):
#         return self.name


# Path: attachments/models.py
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MaxValueValidator
from sorl.thumbnail import get_thumbnail
from authors.models import Organization




class Media(models.Model):
    """A piece of content which has a main component and may have associated
    Authors and a caption."""

    caption = models.TextField(blank=True)

    @property
    def credit(self):
        """Forces child classes to define a "credit" attribute."""

        raise NotImplementedError('Models which inherit from this class must '
                                  'define a "credit" attribute which is a '
                                  'ManyToManyField of authors.Author.')

    def is_courtesy(self):
        """Checks if this Media is courtesy of another organization.

        Returns True if any of the Authors of the Media is not a member of
        this organization."""


        this_organization = Organization.objects.get(pk=1)