本文整理汇总了Python中event.models.Event._has_start_time方法的典型用法代码示例。如果您正苦于以下问题:Python Event._has_start_time方法的具体用法?Python Event._has_start_time怎么用?Python Event._has_start_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event.models.Event
的用法示例。
在下文中一共展示了Event._has_start_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert
# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import _has_start_time [as 别名]
#.........这里部分代码省略.........
full_list.insert(0, headliner)
csv_artist_list = full_list and u",".join(full_list) or u""
quoted_list = [u'"%s"' % a for a in full_list]
hashtag = u",".join(quoted_list)
art_html = [u"<li>%s</li>" % a for a in artist_list]
if headliner:
art_html.insert(0, u'<li class="headliner">%s</li>' % headliner)
art_html = u"<h4 class='artist_title'>Artists</h4><ul class='artist_list'>%s</ul>\n" % u"\n".join(art_html)
desc = u"%s%s" % (art_html, desc)
venue = e['venue']['name'].strip()
venue_address = e['venue']['location']['street'].strip()
venue_city = e['venue']['location']['city'].strip()
venue_zip = e['venue']['location']['postalcode'].strip()
if headliner and venue and headliner == title:
# Change title format to:
# headliner at venue name! mm/dd
mm_dd = event_date.strftime("%m/%d")
title = u"%s at %s! %s" % (headliner, venue, mm_dd)
if len(title) > 120:
title = u"%s.." % title[:118]
lat, lng = None, None
source = ''
if e['venue']['location'].get("geo:point", {}).get("geo:lat", None):
lat = e['venue']['location']["geo:point"]["geo:lat"]
lng = e['venue']['location']["geo:point"]["geo:long"]
lat = str(round(float(lat), 3))
lng = str(round(float(lng), 3))
source = u"%s,%s" % (lat, lng)
tz = e['venue']['location'].get('timezone', '')
event_time = e.get('startTime', "21:00")
has_start_time = 'startTime' in e
image_content = ContentFile(get_raw_image(image))
fname, ext = os.path.splitext(image)
fname = u'%s%s' % (uuid4().hex[::2], ext)
vn, created = Venue.objects.get_or_create(
name=venue[:255],
geo_loc=source,
defaults=dict(
source='last-fm',
address=venue_address[:255],
city=venue_city[:255],
zip_code=venue_zip[:12],
venue_url=venue_url[:255],
)
)
if False and not created and vn.source != 'last-fm':
# Update empty fields
dirty = False
if not vn.address:
vn.address = venue_address[:255]
dirty = True
if not vn.city:
vn.city = venue_city[:255]
dirty = True
if not vn.zip_code:
vn.zip_code = venue_zip[:12]
dirty = True
if not vn.venue_url:
vn.venue_url = venue_url[:255]
dirty = True
if dirty:
vn.save()
if existing_event:
# only update title on this existing event
existing_event.title = title[:120]
super(Event, existing_event).save()
_x.debug("Updated title for %s", existing_event)
else:
user_profile = get_artist_user_profile(headliner)
ex = Event(
lastfm_id = lfm_id,
artist=_ARTIST,
creator=user_profile,
is_submitted=True,
is_approved=True,
title=title[:120],
url=(u"%s-%s" % (slugify(title)[:30], uuid4().hex[::4]))[:35],
description=desc,
venue=vn,
event_date=event_date,
event_start_time=event_time,
event_timezone=tz,
hashtag=u'', # hashtag[:250], # don't fetch tweets for last.fm generated events (3/23/2010)
location=loc,
headliner=headliner[:200] or u'',
artists=csv_artist_list[:250] or u'',
ext_event_source='last.fm',
)
ex._has_start_time = ex.event_start_time and has_start_time
ey = try_merge(ex)
if ey:
# new event is a duplicate; hide it
ex.is_deleted = True
_x.warn("Merged %s into %s", ex, ey)
ex.image.save(fname, image_content, save=False)
ex._create_resized_images(raw_field=None, save=False)
ex.save()
ex.attendee_set.get_or_create(attendee_profile=user_profile)
_x.debug("Saved %s", ex)
n += 1