Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)

src/d/j/django-cached-hitcount-0.1.9/cached_hitcount/models.py   django-cached-hitcount(Download)
 
from cached_hitcount.settings import CACHED_HITCOUNT_IP_CACHE_TIMEOUT, CACHED_HITCOUNT_IP_CACHE
from cached_hitcount.utils import get_hitcount_cache, get_target_ctype_pk
# SIGNALS #
def process_object_saved(sender, **kwargs):
 
    if created:
        ctype, object_pk = get_target_ctype_pk(object)
        Hit.objects.select_for_update().get_or_create(added=datetime.datetime.utcnow().date(), object_pk=object_pk, content_type=ctype)
        from cached_hitcount.views import _update_hit_count#prevent circular import

src/d/j/django-cached-hitcount-0.1.9/cached_hitcount/templatetags/cached_hitcount_tags.py   django-cached-hitcount(Download)
from django import template
from django.core.urlresolvers import reverse
 
from cached_hitcount.utils import get_target_ctype_pk, get_hit_count as get_hit_count_utils
 
    '''
    url = reverse('update_hit_count_ajax')
    ctype, object_pk = get_target_ctype_pk(object)
    csrf_token = unicode(context['csrf_token'])
    return {

src/d/j/django-cached-hitcount-0.1.9/cached_hitcount/tests.py   django-cached-hitcount(Download)
from cached_hitcount.utils import is_cached_hitcount_enabled
from cached_hitcount.models import Hit
from cached_hitcount.utils import get_target_ctype_pk, get_hit_count
from cached_hitcount.tasks import persist_hits
 
    def _create_sample_model(self):
        self.sample_model = Hit()
        self.sample_model.object_pk = 435
        ctype, object_pk = get_target_ctype_pk(self.sample_model)
        self.sample_model.content_type = ctype