Beispiel #1
0
#encoding:utf-8

import os, sys
sys.path.insert(0, os.path.abspath(os.curdir))

from django.db.transaction import commit_on_success
from mc.models import Dealer, DealerType, City, Province
from mc import get_cur_input_term
from django.contrib.auth.models import User, Group
from userpro.models import UserProfile, UserPermission
from userpro.enums import *
import constant
import xlrd
from utils.xpinyin import Pinyin
pinyin = Pinyin()

from django.conf import settings

LISTORDER = 1


@commit_on_success
def update_dealer_listorder(parent=None):
    global LISTORDER
    if not parent:
        LISTORDER = 1
        parent = Dealer.objects.get(pk=1)
        parent.listorder = LISTORDER
        parent.save()
    sub_dealer_list = Dealer.objects.filter(parent=parent).order_by('id')
    for sub_dealer in sub_dealer_list:
Beispiel #2
0
 def save(self, **kwargs):
     p = Pinyin()
     self.pinyin = p.get_pinyin(self.name)
     super(IndicatorCategory, self).save(**kwargs)