def createRuleCategory(id, slug, abbrev, nls, order, title, title_plural, desc, num):

    try:
      rc = RuleCategory.objects.get(category_id=id)
      print 'Updating Rule Category: ' + title
      rc.slug         = slug 
      rc.category_num = num
      rc.abbrev       = abbrev
      rc.title        = title
      rc.title_plural = title_plural
      rc.description  = desc
      rc.order         = order
            
    except ObjectDoesNotExist:

      print "Creating Rule Category: " + title
      rc = RuleCategory(category_id=id, slug=slug, category_num=num, abbrev=abbrev, title=title, title_plural=title_plural, description=desc, order=order)
      
    rc.save()
Пример #2
0
def createRuleCategory(id, slug, nls, order, title, title_plural, code):

    try:
      rc = RuleCategory.objects.get(rule_category_code=code)
      print('Updating Rule Category: ' + title)
      rc.slug               = slug 
      rc.rule_category_code = code
      rc.title              = title
      rc.title_plural       = title_plural
      rc.order              = order
            
    except ObjectDoesNotExist:

      print ("Creating Rule Category: " + title)
      rc = RuleCategory(category_id=id, slug=slug, rule_category_code=code, title=title, title_plural=title_plural, order=order)
      
    rc.save()
    
    return rc
Пример #3
0
def createRuleCategory(id, slug, nls, order, title, title_plural, code):

    try:
        rc = RuleCategory.objects.get(rule_category_code=code)
        print('Updating Rule Category: ' + title)
        rc.slug = slug
        rc.rule_category_code = code
        rc.title = title
        rc.title_plural = title_plural
        rc.order = order

    except ObjectDoesNotExist:

        print("Creating Rule Category: " + title)
        rc = RuleCategory(category_id=id,
                          slug=slug,
                          rule_category_code=code,
                          title=title,
                          title_plural=title_plural,
                          order=order)

    rc.save()

    return rc