本文整理汇总了Python中app.models.Event.title方法的典型用法代码示例。如果您正苦于以下问题:Python Event.title方法的具体用法?Python Event.title怎么用?Python Event.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Event
的用法示例。
在下文中一共展示了Event.title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copyevent
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import title [as 别名]
def copyevent(event_id=None):
new_event=Event()
event=Event.query.get_or_404(event_id)
new_event.title=event.title
new_event.image=event.image
new_event.description=event.description
new_event.begin=event.begin
new_event.end=event.end
new_event.location=event.location
new_event.price=event.price
form = CreateEventForm(obj=new_event)
if form.validate_on_submit():
form.populate_obj(new_event)
new_event.image=new_event.image.replace("https://www.dropbox.com","https://dl.dropboxusercontent.com/")
db.session.add(new_event)
db.session.commit()
flash("Event edited succesfully")
return redirect(url_for("admin.index"))
return render_template('newevent.html',form=form)
示例2: open
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import title [as 别名]
# Read events from events file.
events_file = open(os.path.join(script_dir, 'test_events.txt'), 'rb')
csvreader = csv.reader(events_file, delimiter='|', quotechar='"')
first_row = True
for row in csvreader:
if first_row:
# Skip the header line.
first_row = False
continue
if row[2] in tuxtrax_tracks:
track_name = tuxtrax_tracks[row[2]]
else:
# There is no corresponding track in CREM at this time.
continue
event = Event()
event.title = row[0]
event.description = unicode(row[1], 'utf8')
event.track = db.session.query(Track).\
filter(Track.name == track_name).first()
event.duration = int(row[3])
event.failityRequest = row[4]
event.convention = convention
# Assign a random timeslot.
timeslot_index = random.randint(0, timeslot_count-1)
timeslot = Timeslot.query.filter_by(timeslot_index=timeslot_index).first()
event.timeslots.append(timeslot)
db.session.add(event)
events_file.close()