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


Python Event.name方法代码示例

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


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

示例1: save_event

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import name [as 别名]
def save_event(request):
    """ Create a new event """
    print "In Save Event"
    if request.method != "POST":
        print "Save brew received a non post"
        return HttpResponseRedirect(reverse("events_userhome"))

    name = request.POST.get('event_name')
    description = request.POST.get("event_description")
    
    # On empty POST request, return to user home.
    if(name.strip() == "" and description.strip() == ""):
        print "Empty form received"
        return HttpResponseRedirect(reverse("events_userhome"))

    # Create a new event and save it.
    new_event = Event()
    new_event.name = name
    new_event.description = description
    new_event.save()
    print "New Event Created ", new_event.ident
    print type(new_event.ident), str(new_event.ident)
    # Save the user as the host of the new event
    user = request.user.get_profile()
    admin = Host()
    admin.uid = user
    admin.eid = new_event
    admin.save()
    return HttpResponseRedirect(reverse("events.views.event",
                                        args=(new_event.ident,)))
开发者ID:mangeshgupte,项目名称:event-ogre,代码行数:32,代码来源:views.py

示例2: Event

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import name [as 别名]
from events.models import Event, Vendor

#Accesses the facebook Graph API and parses the response object.
events_page = 'OffTheGridSF/events'
r = requests.get('https://graph.facebook.com/' + events_page + '?access_token=1705064953059017|e3b4439e3577e83f7f6a095a875f3f74')
events = r.json()

#Vendor.objects.all().delete()
#Event.objects.all().delete()

#Iterate through the events objects and save it if the object isn't 
#already in the database.
for event in events['data']:
	if not Event.objects.filter(event_id=event['id'].encode('ascii','ignore')):
		event_obj = Event()
		event_obj.name = event['name'].encode('ascii','ignore')
		event_obj.event_id = event['id'].encode('ascii','ignore')
		event_obj.date = parser.parse(event['start_time'].encode('ascii','ignore'))
		event_obj.description = event['description'].encode('ascii','ignore')
		event_obj.save()

#Scrape through the vendor site and gather a list of vendor names
vendors_page = requests.get('http://offthegridsf.com/vendors')
vendors_file = html.fromstring(vendors_page.text)
vendors = vendors_file.xpath('//a[@class="otg-vendor-name-link"]/text()')
vendors_list = set()

#Parse the vendor list for duplicate items of the form 'x (1)', 'x (20)'
#by stripping the values and adding it to a set which will not allow duplicates.
for vendor in vendors:
	if "(" in vendor:
开发者ID:malcolmmathew,项目名称:foodtruckproject,代码行数:33,代码来源:views.py

示例3: create_event

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import name [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

示例4: Location

# 需要导入模块: from events.models import Event [as 别名]
# 或者: from events.models.Event import name [as 别名]
    #TODO check if exists
    if not Location.objects.filter(location_name=event['club']).exists():
        locationModel = Location()
        locationModel.location_name(event['club'])
        address = event['address'].split(',')
        street = address[0]
        postal = address[2].split(' ')[0]
        city = address[2].split(' ')[1]
        locationModel.street(street)
        locationModel.postal_code(postal)
        locationMode.city(city)
        locationModel.setCoordinates()
        locationModel.save()
    
    if not Event.objects.filter(event_name=event['Title']).exists():
        eventModel = Event()
        Event.name(event['Title'])
        
        #Get time objects
        days = event['Date'].split('-')
        times = event['Time'].split('-')
        if (len(days)==1):
            start = days[0]+ ' '+times[0]
            end = days[0]+ ' '+times[1]
        else:
            year = days[1].split(',')[2].split(' ')[2]
            start = days[0]+', '+year+ ' '+times[0]
            end = days[1]+ ', '+year+ ' '+times[1]
        start = time.strptime(start, '%A, %d %B, %Y $H:%M')
        end = time.strptime(end, '%A, %d %B, %Y $H:%M')
#write_from_db(sort_db(db,5))
开发者ID:Talmaj,项目名称:clubmap,代码行数:33,代码来源:resident_advisor_map_v05.py


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