Did I find the right examples for you? yes no

All Samples(48)  |  Call(35)  |  Derive(0)  |  Import(13)
Returns an aware or naive datetime.datetime, depending on settings.USE_TZ.

        def now():
    """
    Returns an aware or naive datetime.datetime, depending on settings.USE_TZ.
    """
    if settings.USE_TZ:
        # timeit shows that datetime.now(tz=utc) is 24% slower
        return datetime.utcnow().replace(tzinfo=utc)
    else:
        return datetime.now()
        


src/r/a/raspberryio-HEAD/raspberryio/project/models.py   raspberryio(Download)
from mezzanine.core.fields import RichTextField
from mezzanine.utils.models import AdminThumbMixin
from mezzanine.utils.timezone import now
from mezzanine.blog.models import BlogCategory
from mezzanine.core.templatetags.mezzanine_tags import thumbnail
        # Set created and modified datetimes if not provided.
        if not self.id:
            self.created_datetime = now()
        self.modified_datetime = now()
        super(Project, self).save(*args, **kwargs)
            if request.user.is_staff or request.user == self.user:
                return True
        return (self.publish_date <= now() and
            self.status == CONTENT_STATUS_PUBLISHED)
 
                help_text='Upload an image for the home page. Suggested ' \
                          'dimensions are 1252x626px and max 5MB filesize.')
    featured_start_date = models.DateTimeField(default=now(),
                help_text='Date the Project will start being featured on the' \
                          'homepage.')

src/r/a/raspberryio-HEAD/raspberryio/project/templatetags/project_tags.py   raspberryio(Download)
from django import template
 
from mezzanine.core.models import CONTENT_STATUS_PUBLISHED
from mezzanine.utils.timezone import now
 
    def render(self, context):
        featured = FeaturedProject.objects.filter(
                        featured_start_date__lte=now(),
                        project__publish_date__lte=now(),
                        project__status=CONTENT_STATUS_PUBLISHED

src/m/e/mezzanine-recipes-1.0.0/mezzanine_recipes/api.py   mezzanine-recipes(Download)
from mezzanine.blog.models import BlogCategory
from mezzanine.core.models import CONTENT_STATUS_PUBLISHED
from mezzanine.utils.timezone import now
 
from tastypie import fields
    def get_object_list(self, request, *args, **kwargs):
        return Ingredient.objects.filter(Q(recipe__publish_date__lte=now()) | Q(recipe__publish_date__isnull=True),
                                         Q(recipe__expiry_date__gte=now()) | Q(recipe__expiry_date__isnull=True),
                                         Q(recipe__status=CONTENT_STATUS_PUBLISHED))
 
    def get_object_list(self, request, *args, **kwargs):
        return WorkingHours.objects.filter(Q(recipe__publish_date__lte=now()) | Q(recipe__publish_date__isnull=True),
                                           Q(recipe__expiry_date__gte=now()) | Q(recipe__expiry_date__isnull=True),
                                           Q(recipe__status=CONTENT_STATUS_PUBLISHED))
 

src/m/e/mezzanine-recipes-HEAD/mezzanine_recipes/api.py   mezzanine-recipes(Download)
from mezzanine.blog.models import BlogCategory
from mezzanine.core.models import CONTENT_STATUS_PUBLISHED
from mezzanine.utils.timezone import now
 
from tastypie import fields
    def get_object_list(self, request, *args, **kwargs):
        return Ingredient.objects.filter(Q(recipe__publish_date__lte=now()) | Q(recipe__publish_date__isnull=True),
                                         Q(recipe__expiry_date__gte=now()) | Q(recipe__expiry_date__isnull=True),
                                         Q(recipe__status=CONTENT_STATUS_PUBLISHED))
 
    def get_object_list(self, request, *args, **kwargs):
        return WorkingHours.objects.filter(Q(recipe__publish_date__lte=now()) | Q(recipe__publish_date__isnull=True),
                                           Q(recipe__expiry_date__gte=now()) | Q(recipe__expiry_date__isnull=True),
                                           Q(recipe__status=CONTENT_STATUS_PUBLISHED))
 

src/r/a/raspberryio-HEAD/raspberryio/qanda/models.py   raspberryio(Download)
from mezzanine.core.models import Displayable, Ownable
from mezzanine.core.fields import RichTextField
from mezzanine.utils.timezone import now
 
 
    def save(self, *args, **kwargs):
        # Set created and modified datetimes if not provided.
        if not self.id:
            self.created_datetime = now()
        self.modified_datetime = now()

src/m/e/mezzanine_widgets-HEAD/widget/models.py   mezzanine_widgets(Download)
 
from django.db.models import Q
from mezzanine.utils.timezone import now
 
 
            return self.all()
        return self.filter(
            Q(publish_date__lte=now()) | Q(publish_date__isnull=True),
            Q(expiry_date__gte=now()) | Q(expiry_date__isnull=True),
            Q(status=CONTENT_STATUS_PUBLISHED))

src/r/a/raspberryio-HEAD/raspberryio/project/utils.py   raspberryio(Download)
 
from actstream.models import Action
from mezzanine.utils.timezone import now
 
 
    to `number` users. Defaults to 7 days and 4 users.
    """
    yester_date = now() - timedelta(days=days)
    actions = Action.objects.model_actions(User) \
        .filter(timestamp__gte=yester_date) \

src/m/e/mezzanine-recipes-1.0.0/mezzanine_recipes/models.py   mezzanine-recipes(Download)
from mezzanine.core.managers import DisplayableManager
from mezzanine.blog.models import BlogPost as MezzanineBlogPost
from mezzanine.utils.timezone import now
 
from . import fields
    def save(self, *args, **kwargs):
        self.modified_date = now()
        if not self.content_type:
            self.content_type = ContentType.objects.get_for_model(self.__class__)
        super(BlogProxy, self).save(*args, **kwargs)

src/m/e/mezzanine-recipes-HEAD/mezzanine_recipes/models.py   mezzanine-recipes(Download)
from mezzanine.core.managers import DisplayableManager
from mezzanine.blog.models import BlogPost as MezzanineBlogPost
from mezzanine.utils.timezone import now
 
from . import fields
    def save(self, *args, **kwargs):
        self.modified_date = now()
        if not self.content_type:
            self.content_type = ContentType.objects.get_for_model(self.__class__)
        super(BlogProxy, self).save(*args, **kwargs)

src/c/a/cartridge-stripe-0.1.3/cartridge_stripe/forms.py   cartridge-stripe(Download)
from mezzanine.conf import settings
from mezzanine.core.templatetags.mezzanine_tags import thumbnail
from mezzanine.utils.timezone import now
 
from cartridge.shop import checkout

  1 | 2  Next