本文整理汇总了Python中models.Event.date方法的典型用法代码示例。如果您正苦于以下问题:Python Event.date方法的具体用法?Python Event.date怎么用?Python Event.date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Event
的用法示例。
在下文中一共展示了Event.date方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveEventToDB
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import date [as 别名]
def saveEventToDB(event_form,request):
event = Event()
event.category = models.CategoryOptions().get_category_by_id(int(event_form.cleaned_data['category']))
event.budget = event_form.cleaned_data['budget']
event.date = event_form.cleaned_data['date']
event.description = event_form.cleaned_data['description']
event.is_kosher = event_form.cleaned_data['is_kosher']
event.is_vegan = event_form.cleaned_data['is_vegan']
event.is_vegeterian = event_form.cleaned_data['is_vegeterian']
event.picture = event_form.cleaned_data['picture']
event.location = event_form.cleaned_data['location']
event.city = event_form.cleaned_data['city']
event.max_people = event_form.cleaned_data['max_people']
event.name = event_form.cleaned_data['name']
event.organizer_id = request.user.id
user = models.KitchenUser.objects.get(id=request.user.id)
event.save()
participant = models.EventParticipant(event = event, user = user, \
rsvp = models.RsvpOptions().get_rsvp_by_id(int(event_form.cleaned_data['rsvp'])))
participant.save()
return event.id
示例2: beer_gone
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import date [as 别名]
def beer_gone(request, beer_id):
beer = get_object_or_404(Beer, pk=beer_id)
if beer.current_state() == 6:
messages.error(request, "This beer is already marked as 'gone'!")
return redirect('beer-show', beer.id)
# Create a new event marking this beer as gone
event = Event()
event.beer = beer
event.date = datetime.datetime.now().date()
event.event_type = 6 # Hard-coding this is kind of gross...
event.completed = True
event.save()
tweet_event.delay(event)
return redirect('beer-show', beer.id)
示例3: add_event
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import date [as 别名]
def add_event(request):
date = request.POST.get('date')
time = request.POST.get('time')
event_type = request.POST.get('event_type')
description = request.POST.get('description')
dosage = request.POST.get('dosage')
medication_id = int(request.POST.get('select_med'))
user_id = request.user.pk
datetime = str(date) + " " + time
print "datetime", datetime
new_event_entry = Event()
new_event_entry.date = datetime
new_event_entry.event_type = event_type
new_event_entry.description = description
new_event_entry.dosage = dosage
new_event_entry.medication_id = medication_id
new_event_entry.user_id = user_id
new_event_entry.save()
#return render(request, 'med_tracker_app/user_dash.html', { 'new_event' : "You added a new event." })
return HttpResponseRedirect(reverse('med_tracker_app:user_dash'))
示例4: beer_new
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import date [as 别名]
def beer_new(request):
if not request.user.is_superuser:
return redirect('brewhouse-display')
if request.method == 'POST':
form = AddBeerForm(request.POST)
if form.is_valid():
b = Beer()
b.name = form.cleaned_data['name']
b.style = form.cleaned_data['style']
b.recipe_url = form.cleaned_data['recipe_url']
b.save()
# Create some basic events based on the brewed-on date
# tuple is of (event_type, days_since_brew_date)
brew_date = form.cleaned_data['brew_date']
events = (
(7, 0), # brewing
(1, 0), # brewed
(2, 0), # primary fermentation
(3, 7), # secondary fermentation
(4, 21), # kegged
(0, 28), # ready!
)
for etype, num_days in events:
event = Event()
event.beer = b
event.event_type = etype
event.date = brew_date + datetime.timedelta(days=num_days)
event.save()
return redirect('beer-show', b.id)
else:
pass # TODO set an error
else:
form = AddBeerForm()
return render(request, 'brewhouse/new_beer.html', locals())
示例5: __create_Event
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import date [as 别名]
def __create_Event(entry, g, e):
if entry is None:
return None
(rdate, date_format, year_range_end, date_approxQ) = __parse_gen_date(
__child_value_by_tags(entry, 'DATE'))
place = __child_value_by_tags(entry, 'PLAC', default='')
if not (date or place):
return None
if e is None:
e = Event(gedcom=g)
e.date = rdate
e.place = place
e.date_format = date_format
e.year_range_end = year_range_end
e.date_approxQ = date_approxQ
e.save()
return e