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


Python Group.name方法代码示例

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


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

示例1: group

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def group(request):
    dbsession = DBSession()
    name = clean_matchdict_value(request, 'group')
    group = Group()
    group.name = name
    group.timestamp = get_timestamp()
    dbsession.add(group)
    transaction.commit()
    return {'status': 'success'}
开发者ID:vishakh,项目名称:metamkt,代码行数:11,代码来源:views.py

示例2: insert

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
    def insert(self, group_name):
        existing_group = self._get_group(group_name=group_name)
        if existing_group:
            return existing_group

        group = Group()
        group.user = self.user_key
        group.name = group_name
        group.put()
        return group
开发者ID:xplot,项目名称:imeet,代码行数:12,代码来源:group.py

示例3: save_new_group

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def save_new_group(request):

    if request.method == 'POST':
        form = GroupForm(request.POST)
        if form.is_valid():
            group = Group()
            group.name = form.cleaned_data['name']
            group.max_loan_days = form.cleaned_data['max_loan_days']
            group.save()

    return HttpResponseRedirect('/webconf/couchauth/')
开发者ID:GaloC,项目名称:gplib,代码行数:13,代码来源:webconf.py

示例4: groups

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def groups(request):
	if request.method == "GET":
		groups = Group.objects.all()
		return HttpResponse(format_groups(groups), mimetype="application/json")
	elif request.method == "POST":
		group = Group()
		data = json.loads(request.raw_post_data)
		if len(data["name"]) > 0:
			group.name = data["name"]
			group.save()
			return HttpResponse(format_groups([group]), mimetype="application/json")
		raise "Got Error?"
开发者ID:Lovestruck,项目名称:Contacts,代码行数:14,代码来源:views-django.py

示例5: create

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
 def create(self, params):
     group_name = params['group_name']
     try:
         self.db.session.query(Group).filter(Group.name == group_name).one()
         return self.get(warning="Group name already exists")
     except NoResultFound, e:
         group = Group()
         group.name = group_name
         sha1 = hashlib.sha1()
         sha1.update(group.name)
         group.hash_name = sha1.hexdigest()[0:10]
         self.db.session.add(group)
         self.db.session.commit()
         return redirect(url_for('scoreboard', hash_name=group.hash_name))
开发者ID:lilleswing,项目名称:watchparty,代码行数:16,代码来源:groups_controller.py

示例6: edit_prod

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
    def edit_prod(self):
        self.error_field.setStyleSheet("")
        name = unicode(self.name.text())
        if name == "":
            self.error_field.setStyleSheet("font-size:20px; color: red")
            self.error_field.setText(u"Ce champ est obligatoire.")
            return False

        group = Group()
        try:
            group.name = name
            group.save()
            self.cancel()
            self.parent.table_group.refresh_()
        except sqlite3.IntegrityError:
            self.error_field.setStyleSheet("font-size:20px; color: red")
            self.error_field.setText(u"%s existe déjà" % name)
开发者ID:fadiga,项目名称:waritchi,代码行数:19,代码来源:addgroup.py

示例7: __init__

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
    def __init__(self, parent, *args, **kwargs):
        QDialog.__init__(self, parent, *args, **kwargs)

        vbox = QVBoxLayout()
        vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>"))
        self.combo_grp = QComboBox()
        groups = Group()
        groups.name = "Aucun"

        self.list_grp = Group.all()
        self.list_grp.append(groups)
        self.list_grp.reverse()

        for index in self.list_grp:
            sentence = u"%(name)s" % {'name': index.name}
            self.combo_grp.addItem(sentence)

        self.full_name = LineEdit()
        self.msg_e_or_c = FLabel("")
        self.full_name.setFont(QFont("Arial", 16))
        self.phone_number = IntLineEdit()
        self.phone_number.setInputMask("D9.99.99.99")
        self.phone_number.setAlignment(Qt.AlignCenter)
        self.phone_number.setFont(QFont("Arial", 16))

        send_butt = Button(u"Enregistrer")
        send_butt.clicked.connect(self.save_form)
        cancel_but = Button(u"Fermer")
        cancel_but.clicked.connect(self.cancel)

        formbox = QGridLayout()
        formbox.addWidget(FLabel(u"Groupes:"), 0, 0)
        formbox.addWidget(self.combo_grp, 1, 0)
        formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1)
        formbox.addWidget(self.full_name, 1, 1)
        formbox.addWidget(FLabel(u"Numéro: "), 0, 2)
        formbox.addWidget(self.phone_number, 1, 2)
        formbox.addWidget(send_butt, 2, 1)
        formbox.addWidget(cancel_but, 2, 0)
        formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2)

        vbox.addLayout(formbox)
        self.setLayout(vbox)
开发者ID:fadiga,项目名称:waritchi,代码行数:45,代码来源:contact_add.py

示例8: show_group

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def show_group(request, group_id):
    try:
        group = Group.get(group_id)
    except:
        return HttpResponseRedirect('/webconf/couchauth/show_groups/')

    form = GroupForm(instance=group)
    if form.is_valid():
        group = Group()
        group.name = form.cleaned_data['name']
        group.max_loan_days = form.cleaned_data['max_loan_days']
        group.save()
    form_url = "/webconf/couchauth/save_group/%s/" % group_id
    context = { 'form': form,
                'form_title': 'Editar Grupo',
                'group': group,
                'form_url': form_url,
                }
    return render_to_response('webconf/couchauth/form_group.html',
                              context,
                              context_instance=RequestContext(request)
                              )
开发者ID:GaloC,项目名称:gplib,代码行数:24,代码来源:webconf.py

示例9: add_update_game_interact

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def add_update_game_interact(request):
    
    game_id = request.POST.get('game_id')
    name = request.POST.get('name')
    rows = request.POST.get('rows')
    columns = request.POST.get('columns')
    groups_num = request.POST.get('groups_num')
    panels_per_group = request.POST.get('panels_per_group')
    wait_time = request.POST.get('wait_time')
    total_time = request.POST.get('total_time')
    warning_time = request.POST.get('warning_time')
    switch_cost = request.POST.get('switch_cost')
    
    #parse to int
    try:
        rows = int(rows)
        columns = int(columns)
        groups_num = int(groups_num)
        panels_per_group = int(panels_per_group)
        wait_time = int(wait_time)
    except:
        return HttpResponse('Error')

    try:
        game = Game.objects.get(pk = game_id)
    except:
        game = Game()
        game.create_time = datetime.now()
    
    needInitGroupsPanels = True
    if game.rows and game.columns and game.groups_num \
            and game.panels_per_group \
            and game.rows * game.columns==rows*columns \
            and game.groups_num==groups_num and game.panels_per_group==panels_per_group:
        needInitGroupsPanels = False

    game.name = name
    game.rows = rows
    game.columns = columns
    game.groups_num = groups_num
    game.panels_per_group = panels_per_group
    game.wait_time = wait_time
    game.total_time = total_time
    game.warning_time = warning_time
    game.switch_cost = switch_cost
    
    game.save()


    #initial Groups and Panels
    if needInitGroupsPanels:
        Group.objects.filter(game = game).delete()
        for i in range(groups_num):
            group = Group()
            group.game = game
            group.name = "Group %d" % (i+1) 
            group.save()
            for j in range(panels_per_group):
                panel = Panel()
                panel.group = group
                panel.game = game
                panel.name = "Panel %d" % (j+1)
                panel.progress = '0' * rows * columns
                panel.save()



    nextUrl = reverse('mine.views.mine_admin_view')
    return HttpResponseRedirect(nextUrl)
开发者ID:gamblegear,项目名称:djmatt,代码行数:71,代码来源:interact.py

示例10: initData

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import name [as 别名]
def initData(request):
    if not request:
        xls = '../static/data.xls'
    else:
        from FTknowledge.settings import STATIC_ROOT
        from models import Group, TaxKind, TaxTicket, BBField, BBFieldValue, KJKM, KJKMTicket
        xls = '%s/data.xls'%STATIC_ROOT
        bbdict = {}
        s=u'关联增值税报表主表 关联增值税报表主表一 关联增值税报表主表二 固定资产抵扣 关联企业所得税主表 关联税收优惠明细表 关联所得税与流转税对比表 关联财务报表利润表'
        for ss in s.split(' '):
            if not bbdict.has_key(ss):
                bbdict[ss]=BBField.objects.get(fieldname=ss)

    bk = xlrd.open_workbook(xls)



    for sheetname in bk.sheet_names():
        if 'Sheet3' == sheetname:
            continue
        if request:
            if Group.objects.filter(name=sheetname).count()==0:
                group = Group()
                group.name = sheetname
                group.is_active = True
                group.save()
            else:
                group = Group.objects.get(name=sheetname)

        startrow = 2
        # if u'商业类' != sheetname:
        #     continue
        print sheetname
        sh = bk.sheet_by_name(sheetname)

        nrows = sh.nrows
        nclos = sh.ncols
        l = countRows(2,nrows,0,sh)
        for s,e in l:
            print '(%s,%s):%s'%(s,0,sh.cell_value(s,0))

            if request:
                sname=sh.cell_value(s,0)
                if TaxKind.objects.filter(name=sname).count()==0:
                    tax = TaxKind()
                    tax.name = sname
                    tax.fatherKind = None
                    tax.is_active = True
                    tax.save()
                else:
                    tax = TaxKind.objects.get(name=sname)
            zl = countRows(s,e+1,1,sh)
            for ss,ee in zl:
                print '(%s,%s):%s'%(ss,1,sh.cell_value(ss,1))

                if request:
                    ssname = sh.cell_value(ss,1)
                    if TaxKind.objects.filter(name=ssname,fatherKind=tax).count()==0:
                        sstax = TaxKind()
                        sstax.name = ssname
                        sstax.fatherKind = tax
                        sstax.is_active = True
                        sstax.save()
                    else:
                        sstax = TaxKind.objects.get(name =ssname,fatherKind=tax)

                pl = countRows(ss,ee+1,2,sh)
                for ps,pe in pl:
                    print '(%s,%s):%s'%(ps,2,sh.cell_value(ps,2))
                    if request:
                        psname = sh.cell_value(ps,2)
                        if TaxTicket.objects.filter(name=psname,group=group,taxkind=sstax).count()==0:
                            ticket = TaxTicket()
                            ticket.name = psname
                            ticket.group = group
                            ticket.taxkind = sstax
                            ticket.save()
                        else:
                            ticket = TaxTicket.objects.get(name=psname,group=group,taxkind=sstax)

                        try:
                            t = Ticket()
                            t.name = psname
                            t.save()
                        except:
                            pass


                    print '(%s,%s):%s'%(ps,3,sh.cell_value(ps,3))
                    if request:
                        kjkmname = sh.cell_value(ps,3)
                        if KJKM.objects.filter(name = kjkmname).count()==0:
                            kjkm = KJKM()
                            kjkm.name = kjkmname
                            kjkm.save()
                        else:
                            kjkm = KJKM.objects.get(name=kjkmname)

                        if KJKMTicket.objects.filter(kjkm=kjkm,tickets=ticket).count()==0:
                            kjkmticket = KJKMTicket()
#.........这里部分代码省略.........
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:103,代码来源:importExcel.py


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