当前位置: 首页>>代码示例>>Python>>正文


Python Event.end_date方法代码示例

本文整理汇总了Python中events.models.Event.end_date方法的典型用法代码示例。如果您正苦于以下问题:Python Event.end_date方法的具体用法?Python Event.end_date怎么用?Python Event.end_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在events.models.Event的用法示例。


在下文中一共展示了Event.end_date方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GenerateTestData

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import end_date [as 别名]
def GenerateTestData(events, actions):
    mindate = datetime.datetime(2012, 01, 01)
    startdiffusion = 180
    maxdate = datetime.datetime(2012, 12, 31)
    enddiffusion = 180
    stcmindiff = 12
    stcdiff = 20
    for enr in range(events):
        dt = mindate + datetime.timedelta(random.randint(0, startdiffusion))
        deleted = random.randint(0, 4) == 0
        evt = Event()
        evt.start_date = dt
        evt.start_time = datetime.time(0, 0, 0)
        evt.end_date = maxdate - datetime.timedelta(random.randint(0, enddiffusion))
        evt.end_time = datetime.time(23, 59, 59)
        evt.deleted = deleted
        evt.pub_date = dt + datetime.timedelta(random.randint(-7, 7))
        evt.status = random.randint(0, 3)
        evt.save()
        act1 = Activity()
        # act1.user = "szp"
        act1.verb = VERB_CHANGED + " 3"
        act1.target_content_type_id = 9  # "event"
        act1.target_object_id = evt.pk
        act1.timestamp = dt
        act1.save()
        for actnr in range(actions):
            dt = dt + datetime.timedelta(random.randint(stcmindiff, stcmindiff + stcdiff))
            act = Activity()
            # act.user = "szp"
            if actnr + 1 == actions and deleted:
                act.verb = VERB_DELETED
                act.subject_content_type_id = 9  # "event"
                act.subject_object_id = evt.pk
            else:
                act.verb = "%s %d" % (VERB_CHANGED, random.randint(0, 3))
                act.target_content_type_id = 9  # "event"
                act.target_object_id = evt.pk
            act.timestamp = dt
            act.save()
开发者ID:szabopeter,项目名称:pulitest,代码行数:42,代码来源:views.py

示例2: create_event

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import end_date [as 别名]
def create_event(request):
    if request.method == 'POST':
        event_name = request.POST.get('event_name', None)
        event_image = request.POST.get('event_image', None)
        start_date = request.POST.get('start_date', None)
        end_date = request.POST.get('end_date', None)
        due_date = request.POST.get('due_date', None)
        goal = request.POST.get('goal', None)
        progress = request.POST.get('progress', None)
        event_description = request.POST.get('event_description', None)
        location_street = request.POST.get('location_street', None)
        location_number = request.POST.get('location_number', None)
        location_suburb = request.POST.get('location_suburb', None)
        location_neighborhood = request.POST.get('location_neighborhood', None)
        location_zip_code = request.POST.get('location_zip_code', None)
        location_city = request.POST.get('location_city', None)
        minimum_attendance = request.POST.get('minimum_attendance', None)
        maximum_attendance = request.POST.get('maximum_attendance', None)
        category_name = request.POST.get('category_name', None)
        restriction_name = request.POST.get('restriction_name', None)
        restriction_description = request.POST.get('restriction_description', None)
        tier_name = request.POST.get('tier_name', None)
        tier_price = request.POST.get('tier_price', None)
        tier_description = request.POST.get('tier_description', None)
        if (event_name and
            event_image and
            start_date and
            end_date and
            due_date and
            goal and
            progress and
            event_description and
            location_street and
            location_number and
            location_suburb and
            location_neighborhood and
            location_zip_code and
            location_city and
            minimum_attendance and
            maximum_attendance and
            category_name and
            restriction_name and
            restriction_description and
            tier_name and
            tier_price and
            tier_description):
            event = Event()
            event.name = event_name
            event.event_image = event_image
            event.start_date = start_date
            event.end_date = end_date
            event.due_date = due_date
            event.goal = goal
            event.progress = progress
            event.description = event_description
            event.location_street = location_street
            event.location_number = location_number
            event.location_suburb = location_suburb
            event.location_neighborhood = location_neighborhood
            event.location_zip_code = location_zip_code
            event.location_city = location_city
            event.minimum_attendance = minimum_attendance
            event.maximum_attendance = maximum_attendance
            event.save()
            category = EventCategory()
            category.category_name = category_name
            category.save()
            restriction = Restriction()
            restriction.name = restriction_name
            restriction.description = restriction_description
            restriction.save()
            tier = EventTier()
            tier.event = event
            tier.name = tier_name
            tier.price = tier_price
            tier.description = tier_description
            tier.save()
            return redirect('/events')
    return render(request, 'events/create.html', {})
开发者ID:maumg1196,项目名称:Eventstarter,代码行数:81,代码来源:views.py


注:本文中的events.models.Event.end_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。