• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Activity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中models.Activity的典型用法代码示例。如果您正苦于以下问题:Python Activity类的具体用法?Python Activity怎么用?Python Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: get

	def get(self, *args):
		respo = self.response.out.write
		output = self.dbg
		
		respo ("<html><head><title>Test</title></head><body>")
		if (self.request.path.endswith('/clean')):
			output ("Begin Clean Up")
			self.cleanUp()
			output ("Cleaning up done")
			return
		output("Now let's go")
		billList = [('Cort', '75.5'), ('Balls', '15')]
		output ("BillList: ", billList)
		
		allacts = Activity.all()
		for act in allacts:
			bill = act.bill
			for entry in bill:
				output ("Entry:", entry, ",", lb = False)
			output()
			output ("acts:", act.key().id(), "Total Expense:", act.expense, "Expanse Bill: ", bill)
		
		mem = Membership.all().get()
		output ("New activity")
		act = Activity(name = "test act", duration=2.0, organizer = mem.user, club = mem.club, bill = billList, expense = '100' )
		output ("Expense:", act.expense)
		output ("Bill:", act.bill)
		output ("Now, put")
		key = act.put()
		output ("Act Saved: ", act.is_saved(), "Key is ", key, " Id is", key.id())
		respo("</body></html>")
开发者ID:cardmaster,项目名称:makeclub,代码行数:31,代码来源:test.py


示例2: WritingOff

def WritingOff(request, id_number):
    try:
        project = Object.objects.get(id=int(id_number))
    except ObjectDoesNotExist:
        return HttpResponse('Об’єкт не існує.<br>Спробуйте інший id.')

    if request.method == 'POST':
        form = WritingOffForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            act = Activity(time_stamp=dt.now(), aim = project, type='Списання', actor=Custom.myUser.objects.get(username=request.user.username))
            act.save()
            project.save()
            for (k, v) in cd.items():
                if k=='material':
                    v = unicode(v[1:-1].replace('u\'', '').replace('\'', ''))
                attr_assign = AttributeAssignment(attr_name=k, attr_value=v, attr_label=form.fields[k].label,
                                                  event_initiator=act, aim=project)
                attr_assign.save()
            return HttpResponseRedirect('/')
        else:
            return render(request, 'AddOnTs.html', {'form': form, 'errors': form.errors})
    else:
        ps_code = get_attrib_assigns('Приймання на постійне зберігання', project, 'PS_code')
        inventory_number = get_attrib_assigns('Інвентарний облік', project, 'inventory_number')
        spec_inventory_numb = get_attrib_assigns('Спеціальний інвентарний облік', project, 'spec_inventory_numb')
        ts_code = get_attrib_assigns('Приймання на тимчасове зберігання', project, 'TS_code')
        data = {'name': project.name, 'is_fragment': project.is_fragment, 'amount': project.amount,
                'note': project.note, 'PS_code': ps_code, 'inventory_number': inventory_number,
                'spec_inventory_numb': spec_inventory_numb, 'TS_code': ts_code,
                }
        form = WritingOffForm(initial=data)
    return render(request, 'AddOnTs.html', {'form': form, 'label': 'Списати об’єкт'})
开发者ID:demvy,项目名称:museum,代码行数:33,代码来源:views.py


示例3: _parse_activities_response

    def _parse_activities_response(self, jsonBody):
        """

        """

        activities = []
        
        data = json.loads(str(jsonBody))
        for activity in data['data']:
            # Create a new activity
            a = Activity(id=activity['id'], version=activity['version'])
            # Get the coords and set the geometry
            # Check first the geometry type
            # Handle MultiPoint geometries
            if activity['geometry']['type'].lower() == "multipoint":
                points = []
                for coords in activity['geometry']['coordinates']:
                    points.append(QgsPoint(coords[0], coords[1]))
                a.setGeometry(QgsGeometry.fromMultiPoint(points))
            # Handle Point geometries
            if activity['geometry']['type'].lower() == "point":
                coords = activity['geometry']['coordinates']
                a.setGeometry(QgsGeometry.fromPoint(QgsPoint(coords[0], coords[1])))

            # Append it to the list
            activities.append(a)

        return activities
开发者ID:CDE-UNIBE,项目名称:lo-editor2,代码行数:28,代码来源:OlaInterfaceDialog.py


示例4: login_User

def login_User(request):
    if request.method == "POST":
        username = request.POST['username']
        password = request.POST['password']
        user = authenticate(username=username, password=password)

        if user != None:
            if user.is_active == True:
                userprofile = user.userprofile

                login(request, user)
                messages.success(request, 'Welcome, %s!' % (username))
                Activity.log_activity("ACTIVITY_LOGIN", user.userprofile)
                next_url = request.GET.get('next', URL_HOME)

                if "//" in next_url and re.match(r'[^\?]*//', next_url):
                    next_url = settings.LOGIN_REDIRECT_URL
                return redirect(next_url)

            else:
                messages.error(request, "You haven't activated your account yet. Please check your email.")
        else:
            messages.error(request, 'Invalid Login credentials. Please try again.')

    next_path = request.GET.get('next', URL_HOME)
    form = AuthenticationForm()
    return render_to_response(HTML_LOGIN, {'form':form}, RequestContext(request, {'next': next_path}))
开发者ID:Project-EPIC,项目名称:emergencypetmatcher,代码行数:27,代码来源:views.py


示例5: TempSave

def TempSave(request, id_number=0):
    try:
        project = Object.objects.get(id=int(id_number))
    except ObjectDoesNotExist:
        if id_number != 0:
            return HttpResponse('Об’єкт не існує.<br>Спробуйте інший id.')
        else:
            project = Object(name='Новий')
    if request.method == 'POST':
        form = TempSaveForm(request.POST, request.FILES)
        if form.is_valid():
            cd = form.cleaned_data
            act = Activity(time_stamp=dt.now(), aim=project, type='Приймання на тимчасове зберігання', actor=Custom.myUser.objects.get(username=request.user.username))
            act.save()
            project.reason = cd['reason']
            project.save()
            for (k, v) in cd.items():
                if k=='material':
                    v = unicode(v[1:-1].replace('u\'', '').replace('\'', ''))
                attr_assign = AttributeAssignment(attr_name=k, attr_value=v, attr_label=form.fields[k].label,
                                                  event_initiator=act, aim=project)
                attr_assign.save()
            return HttpResponseRedirect('/')
        else:
            return render(request, 'AddOnTs.html', {'form': form})
    else:
        data = {'name': project.name, 'is_fragment': project.is_fragment, 'amount': project.amount,
                'date_creation': project.date_creation, 'place_of_creation': project.place_of_creation,
                'author': project.author, 'technique': project.technique, 'material': project.material.decode('unicode-escape').split(', '),
                'size': project.size, 'condition': project.condition, 'condition_descr': project.condition_descr, 'description': project.description,
                'price': project.price, 'note': project.note}
        form = TempSaveForm(initial=data)
        return render(request, 'AddOnTs.html', {'form': form, 'label': 'Прийняти об’єкт на ТЗ'})
开发者ID:demvy,项目名称:museum,代码行数:33,代码来源:views.py


示例6: chooseActivity

def chooseActivity(request):
	if request.method=='POST':
		
		#OK this is super not the way to do this, but oh well
		#also, may end up trying to add an activity and not be able to
		#super confusing probably, not at all the right way to do things
		pvalues=request.POST.copy()
		if not request.POST['activity']:
			if len(request.POST['add_activity']):
				newActivity=Activity(name=request.POST['add_activity'])
				newActivity.save(request)
				pvalues['activity']=newActivity.id
		aform=ActivityChooseForm(pvalues, request=request)

		if aform.is_valid():
			aRating=aform.save(commit=False)
			aRating.preDateTime=datetime.datetime.now()
			aRating.save(request)
			rform=ActivityRatingForm(instance=aRating)
			pk=aRating.id
			redirectURL='/activity/'+str(pk)+'/rate/'
			return redirect(redirectURL) 
		else:
			return render(request, 'activity/choose.html', {'aform':aform})
	aform=ActivityChooseForm(request=request)
	return render(request, 'activity/choose.html',{'aform':aform})
开发者ID:icnivad,项目名称:kibun,代码行数:26,代码来源:views.py


示例7: FromPSToTS

def FromPSToTS(request, id_number):
    try:
        project = Object.objects.get(id=int(id_number))
    except ObjectDoesNotExist:
        return HttpResponse('Об’єкт не існує.<br>Спробуйте інший id.')

    if request.method == 'POST':
        form = FromPStoTSForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            act = Activity(time_stamp=dt.now(), aim = project, type='Видача предметів з Постійного зберігання на Тимчасове зберігання', actor=Custom.myUser.objects.get(username=request.user.username))
            act.save()
            project.save()
            for (k, v) in cd.items():
                if k=='material':
                    v = unicode(v[1:-1].replace('u\'', '').replace('\'', ''))
                attr_assign = AttributeAssignment(attr_name=k, attr_value=v, attr_label=form.fields[k].label,
                                                  event_initiator=act, aim=project)
                attr_assign.save()
            return HttpResponseRedirect('/')
        else:
            return render(request, 'AddOnTs.html', {'form': form, 'errors': form.errors})
    else:
        ps_code = get_attrib_assigns('Приймання на постійне зберігання', project, 'PS_code')
        inventory_number = get_attrib_assigns('Інвентарний облік', project, 'inventory_number')
        data = {'name': project.name, 'is_fragment': project.is_fragment, 'amount': project.amount,
                'date_creation': project.date_creation, 'place_of_creation': project.place_of_creation,
                'author': project.author, 'technique': project.technique, 'material': project.material.decode('unicode-escape').split(', '),
                'size': project.size, 'description': project.description, 'note': project.note,
                'condition': project.condition, 'condition_descr': project.condition_descr,
                'PS_code': ps_code, 'inventory_number': inventory_number,
                }
        form = FromPStoTSForm(initial=data)
    return render(request, 'AddOnTs.html', {'form': form, 'label': 'Видати об’єкт з ПЗ на ТЗ'})
开发者ID:demvy,项目名称:museum,代码行数:34,代码来源:views.py


示例8: activity

def activity(r, u='', action='', group=''):
    timestamp = datetime.now().strftime('%Y%m%d%H%M%S')
    act = Activity(believer=u, group=group, timestamp=timestamp,
                   action=action, ipaddress=IP(r),
                   source='web', category='track')
    act.save(True)
    return 'OK'
开发者ID:dalinhuang,项目名称:demodemo,代码行数:7,代码来源:views.py


示例9: rateCivi

def rateCivi(request):
    civi_id = request.POST.get('civi_id', '')
    rating = request.POST.get('rating', '')
    account = Account.objects.get(user=request.user)

    c = Civi.objects.get(id=civi_id)

    try:
        prev_act = Activity.objects.get(civi=c, account=account)
    except Activity.DoesNotExist:
        prev_act = None

    try:


        activity_data = {
            'account': account,
            'thread': c.thread,
            'civi': c,
        }

        if rating == "vneg":
            c.votes_vneg = c.votes_vneg + 1
            vote_val = 'vote_vneg'
        elif rating == "neg":
            c.votes_neg = c.votes_neg + 1
            vote_val = 'vote_neg'
        elif rating == "neutral":
            c.votes_neutral = c.votes_neutral + 1
            vote_val = 'vote_neutral'
        elif rating == "pos":
            c.votes_pos = c.votes_pos + 1
            vote_val = 'vote_pos'
        elif rating == "vpos":
            # c.votes_vpos = c.votes_vpos + 1
            vote_val = 'vote_vpos'
        activity_data['activity_type'] = vote_val

        c.save()

        if prev_act:
            prev_act.activity_type = vote_val
            prev_act.save()
            data = {
                'civi_id':prev_act.civi.id,
                'activity_type': prev_act.activity_type,
                'c_type': prev_act.civi.c_type
            }
        else:
            act = Activity(**activity_data)
            act.save()
            data = {
                'civi_id':act.civi.id,
                'activity_type': act.activity_type,
                'c_type': act.civi.c_type
            }
        return JsonResponse({'data' : data})
    except Exception as e:
        return HttpResponseServerError(reason=str(e))
开发者ID:CiviWikiorg,项目名称:CiviWiki,代码行数:59,代码来源:write.py


示例10: register_activity

def register_activity(request, time='', data='', client=''):
    carrier, created = Carrier.objects.get_or_create(data=data) 
 
    if carrier.is_registered():
        Activity.create(time, client, carrier)
        return HttpResponse(status=200)
    else:
        return HttpResponse(status=403)
开发者ID:RadoRado,项目名称:checkin-at-fmi,代码行数:8,代码来源:views.py


示例11: auto_checkout

def auto_checkout():
    active_checkins = Checkin.checkins.active()
    for checkin in active_checkins:
        auto_checkout_activity = Activity()
        auto_checkout_activity = checkin.checkin_activity
        auto_checkout_activity.time = datetime.datetime.now()
        auto_checkout_activity.save()
        checkin.checkout_activity = auto_checkout_activity
        checkin.save()
开发者ID:RadoRado,项目名称:checkin-at-fmi,代码行数:9,代码来源:cron.py


示例12: create_activity

def create_activity(activity_type, lead=None, job=None):
	description = None
	lead_key = None
	job_key = None

	if job is not None and job.key is not None:
		job_key = job.key

	if lead is not None and lead.key is not None:
		lead_key = lead.key
	else:
		if job is not None and job.lead is not None:
			lead_key = job.lead


	if activity_type == 'LEAD_SENT':
		description = _build_lead_sent_description(lead.to_json())
	elif activity_type == 'LEAD_READ':
		description = _build_lead_read_description(lead)
	elif activity_type == 'LEAD_CLICKED':
		description = _build_lead_clicked_description(lead)
	elif activity_type == 'LEAD_PENDING_PAYMENT':
		description = _build_lead_pending_payment_description(lead)
	elif activity_type == 'LEAD_CONVERTED':
		description = _build_lead_converted_description(lead)
	elif activity_type == 'JOB_CREATED':
		Activity.set_job_in_all_lead_activities(job)
		description = _build_job_created_description(job)
	elif activity_type == 'JOB_ASSIGNED':
		description = 'The job has been taken by a Flixer'
	elif activity_type == 'JOB_CANCELLED_BY_FLIXER':
		description = 'The job has been cancelled by the flixer'
	elif activity_type == 'JOB_CANCELLED_BY_PROPERTY_OWNER':
		description = 'The job has been cancelled by the property owner'
	elif activity_type == 'JOB_RESCHEDULED':
		description = 'The job has been rescheduled by the property owner'
	elif activity_type == 'JOB_PUBLISHING_STARTED':
		description = 'The job publishing has been started'
	elif activity_type == 'JOB_PUBLISHING_DONE':
		description = 'The job publishing has been done'
	elif activity_type == 'JOB_PUBLISHING_REDO_DONE':
		description = 'The job fixes publishing has been done'
	elif activity_type == 'JOB_REPROVED':
		description = 'The property owner has reproved the job'
	elif activity_type == 'JOB_APPROVED':
		description = 'The property owner has approved the job'
	elif activity_type == 'JOB_PUBLISHED_AT_VALUEGAIA':
		description = 'The job has been published at ValueGaia'
	elif activity_type == 'JOB_FINISHED':
		description = 'The job has been finished'


	if description is not None:
		Activity.create(description, activity_type, lead_key=lead_key, job_key=job_key)

	return True
开发者ID:jesse1983,项目名称:pymay,代码行数:56,代码来源:activity_helper.py


示例13: challenge_count

def challenge_count(player, days=None):
    """
     Return the count of challenges played by player in the last x _days_.
     All challenges if days == None
    """
    if not days:
        return Activity.get_player_activity(player).filter(action__contains='chall').count()
    start = datetime.now() - timedelta(days=days)
    return Activity.get_player_activity(player).filter(
            action__contains='chall', timestamp__gte=start).count()
开发者ID:AndreiRO,项目名称:wouso,代码行数:10,代码来源:achievements.py


示例14: logout_User

def logout_User(request):
    # Update last_logout date field
    user = get_object_or_404(UserProfile, pk=request.user.userprofile.id)
    user.last_logout = datetime.now()
    user.save()

    Activity.log_activity("ACTIVITY_LOGOUT", request.user.userprofile)
    messages.success(request, "See you next time!")
    logout(request)
    return redirect(URL_HOME)
开发者ID:Project-EPIC,项目名称:emergencypetmatcher,代码行数:10,代码来源:views.py


示例15: update_visibility

def update_visibility(aid):
    """
    Pulls the existing activity and then pushes it again
    
    """
    logger.warning('update_visibility aid:%s' % aid)
    logger.warning('update_visibility aid:%s pulling' % aid)
    Activity.pull(aid, confirmed = False)
    logger.warning('update_visibility aid:%s pushing' % aid)
    push_activity(aid)
    logger.warning('update_visibility aid:%s pushed' % aid)
开发者ID:pchennz,项目名称:KEEN-full,代码行数:11,代码来源:tasks.py


示例16: Passport

def Passport(request, id_number):
    try:
        project = Object.objects.get(id=int(id_number))
    except ObjectDoesNotExist:
        if id_number != '0':
            return HttpResponse('Об’єкт не існує.<br>Спробуйте інший id.')
        else:
            project = Object(name='Новий')
    if request.method == 'POST':
        form = PassportForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            project.save()
            act = Activity(time_stamp=dt.now(), aim = project, type='Науково-уніфікований паспорт', actor=Custom.myUser.objects.get(username=request.user.username))
            act.save()
            for (k, v) in cd.items():
                if k=='material':
                    v = unicode(v[1:-1].replace('u\'', '').replace('\'', ''))
                attr_assign = AttributeAssignment(attr_name=k, attr_value=v, attr_label=form.fields[k].label,
                                                  event_initiator=act, aim=project)
                attr_assign.save()
            return HttpResponseRedirect('/')
        else:
            return render(request, 'AddOnTs.html', {'form': form, 'errors': form.errors})
    else:
        collection = get_attrib_assigns('Інвентарний облік', project, 'collection')
        ps_code = get_attrib_assigns('Приймання на постійне зберігання', project, 'PS_code')
        inventory_number = get_attrib_assigns('Інвентарний облік', project, 'inventory_number')
        spec_inventory_numb = get_attrib_assigns('Спеціальний інвентарний облік', project, 'spec_inventory_numb')
        old_inventory_numbers = get_attrib_assigns('Інвентарний облік' or 'Приймання на постійне зберігання',project, 'old_registered_marks')
        date_place_creation = ' '.join([project.date_creation, project.place_of_creation])
        date_place_detection = ' '.join([project.date_detection, project.place_detection])
        date_place_existence = ' '.join([project.date_existence, project.place_existence])
        source = get_attrib_assigns('Приймання на постійне зберігання', project, 'source')
        classify = get_attrib_assigns('Інвентарний облік', project, 'classify')
        typology = get_attrib_assigns('Інвентарний облік', project, 'typology')
        metals = get_attrib_assigns('Спеціальний інвентарний облік', project, 'metals')
        stones = get_attrib_assigns('Спеціальний інвентарний облік', project, 'stones')
        bibliography = get_attrib_assigns('Інвентарний облік', project, 'bibliography')
        data = {'collection': collection, 'PS_code': ps_code, 'inventory_number': inventory_number,
                'spec_inventory_numb': spec_inventory_numb, 'old_inventory_numbers': old_inventory_numbers,
                'identifier': project.identifier, 'storage': project.storage,
                'name': project.name, 'author': project.author, 'date_place_creation': date_place_creation,
                'date_place_detection': date_place_detection, 'date_place_existence': date_place_existence,
                'source': source, 'way_of_found': project.way_of_found, 'link_on_doc': project.link_on_doc,
                'classify': classify, 'typology': typology, 'amount': project.amount,
                'size': project.size, 'material': project.material.decode('unicode-escape').split(', '), 'technique': project.technique,
                'metals': metals, 'stones': stones, 'description': project.description,
                'condition': project.condition, 'condition_descr': project.condition_descr,
                'recomm_for_restauration': project.recomm_for_restauration,
                'transport_possibility': project.transport_possibility, 'price': project.price,
                'bibliography': bibliography}
        form = PassportForm(initial=data)
    return render(request, 'AddOnTs.html', {'form': form, 'label': 'Створити науково-уніфікований паспорт об’єкта'})
开发者ID:demvy,项目名称:museum,代码行数:54,代码来源:views.py


示例17: saveDataFromRequest

 def saveDataFromRequest(self, req_body):
     request_objs = req_body.splitlines()
     students = json.loads(request_objs[0])
     activities = json.loads(request_objs[1])
     comments = json.loads(request_objs[2])
     
     Student.get_from_json(students)
     
     Comment.get_from_json(comments) 
     
     Activity.get_from_json(activities) 
开发者ID:vkcis350,项目名称:NetterProject,代码行数:11,代码来源:main.py


示例18: public_act

def public_act(request):
    ret_data={}
    errors =[]
    if request.method=='POST':
        if 'user' in request.session:
            theme_act = request.POST.get('theme_act','')
            if not theme_act:
                errors.append('theme not exist')
            class_act  = request.POST.get('class_act','')
            date_act   = request.POST.get('date_act','')
            time_act   = request.POST.get('time_act','')
            num_act    = request.POST.get('num_act','')
            address_act = request.POST.get('address_act','')
            detail_act = request.POST.get('detail_act','')
            username = request.session['user']
            date_time = date_act + " " + time_act
            userid = User.objects.get(name=username).id
            now = datetime.datetime.fromtimestamp(time.mktime(time.
                    strptime(date_time, r"%Y/%m/%d %H:%M:%S")))
            datess = str(now)
            print datess
            try:
                a = int(num_act)
            except Exception:
                ret_data["ret"] = 'no int'
                return HttpResponse(json.dumps(ret_data), content_type='application/json')
            print "now is  " +str(datess)
            if len(errors) > 0:
                ret_data['ret'] = 'no theme'
            elif not num_act:
                ret_data['ret'] = 'no people_count'
            else:
                pub_data = Activity(category = class_act, theme = theme_act,
                    begin_datatime = datess, people_count = num_act,
                    details = detail_act, submit_peopleId = userid,
                    location=address_act,joined_peopleId=userid)
                #total=len(Activity.objects.all())+1
                pub_data.istimeout = 'n'
                pub_data.save()
                total = pub_data.id
                u=User.objects.get(id=userid)
                if u.uncompleted_id=='':
                    u.uncompleted_id=str(total)
                else:
                    u.uncompleted_id+=(','+str(total))
                u.save()
                ret_data['ret'] = 'ok'
        else:
            ret_data['ret'] = 'failed'
    else:
        ret_data['ret'] = 'failed'
    return HttpResponse(json.dumps(ret_data), content_type='application/json')
开发者ID:XimingCheng,项目名称:iSport,代码行数:52,代码来源:views.py


示例19: filterActivityData

def filterActivityData(dayOfActivityData):
    #filter
    walkingArray = []
    runningArray = []
    stationaryArray = []
    carArray = []
    unknownArray = []
    lastobj = Activity(duration=0,type=1)
    sumDuration = 0
    for actobj in dayOfActivityData:
        if actobj.type == 1:
            if lastobj.type == 1:
                if len(walkingArray) > 0:
                    sumDuration = actobj.duration + walkingArray[len(walkingArray)-1]
            else:
                sumDuration = actobj.duration
            walkingArray.append(sumDuration)
        elif actobj.type == 2:
            if lastobj.type == 2:
                if len(runningArray) > 0:
                    sumDuration = actobj.duration + runningArray[len(runningArray)-1]
            else:
                sumDuration = actobj.duration
            runningArray.append(sumDuration)
        elif actobj.type == 3:
            if lastobj.type == 3:
                if len(stationaryArray) > 0:
                    sumDuration = actobj.duration + stationaryArray[len(stationaryArray)-1]
            else:
                sumDuration = actobj.duration
            stationaryArray.append(sumDuration)
        elif actobj.type == 4:
            if lastobj.type == 4:
                if len(carArray) > 0:
                    sumDuration = actobj.duration + carArray[len(carArray)-1]
            else:
                sumDuration = actobj.duration
            carArray.append(sumDuration)
        else:    
            if lastobj.type == 5:
                if len(unknownArray) > 0:
                    sumDuration = actobj.duration + unknownArray[len(unknownArray)-1]
            else:
                sumDuration = actobj.duration
            unknownArray.append(sumDuration)
            lastobj = actobj
            lastobj.duration = actobj.duration
            lastobj.type = actobj.type
    filteredData = {"walking":walkingArray,"running":runningArray,"stationary":stationaryArray,"car":carArray,"unknown":unknownArray}
    return filteredData
开发者ID:i3l,项目名称:HIE_FALL_2013,代码行数:50,代码来源:vik.py


示例20: fund

def fund(row):
  ''' A funding of a new individual Takes in a list of a row in CSV.'''
  port_indi = Port_Indi()
  act = Activity()
  
  # Creating the new portfolio/individual    
  port_indi.cash = row[2]
  port_indi.networth = row[2]
  port_indi.name = row[1]
  
  # Check to see if its an Individual or a Porfolio
  if row[0] == 'fund':
    port_indi.is_individual = False
  else:
    port_indi.is_individual = True
  #port_indi.last_quote = Quote()
  port_indi.last_activity = act
  port_indi.save()
  
  # Activity
  act = Activity()
  act.amount = row[2]
  act.act_type = "fund"
  act.port_indi1 = port_indi
  act.date = row[3].replace('-', '')
  act.save()
  
  # Referencing activity
  port_indi.last_activity = act
  port_indi.save()
  print str(port_indi) + ' HAS BEEN FUNDED'
开发者ID:zinglax,项目名称:cmsc424Site,代码行数:31,代码来源:investment_manager.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Actor类代码示例发布时间:2022-05-27
下一篇:
Python models.Account类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap