@classmethod
def base_queryset(cls):
    """
        Returns a queryset of objects of this type to use as a base
        for calling get_or_create() on.

        You can use the `select_related` attribute on your class to
        specify a list of foreign key field names, which the method
        will attempt to select additional related-object data for
        when the query is executed.

        If your needs are more complex than this, you can override
        this method on your custom class.
        """
    queryset = cls.objects.all()
    if cls.select_related is not None:
        queryset = queryset.select_related(*cls.select_related)
    return queryset
