Source code for mezzanine.twitter.managers

from __future__ import unicode_literals

from django.db.models import Manager

[docs]class TweetManager(Manager): """ Manager that handles generating the initial ``Query`` instance for a user, list or search term. """
[docs] def get_for(self, query_type, value): """ Create a query and run it for the given arg if it doesn't exist, and return the tweets for the query. """ from mezzanine.twitter.models import Query lookup = {"type": query_type, "value": value} query, created = Query.objects.get_or_create(**lookup) if created: elif not query.interested: query.interested = True return query.tweets.all()