Exemplo n.º 1
0
    def add_category_records(self, categories, user_id, brab_id):
        category_count = 0
        for categ_id in categories:
            category_count = category_count + 1
            category_link = Category_to_brab(auth_user_id = user_id, brab_id = brab_id, category_id = categ_id)

            category_link.save()

        return category_count
Exemplo n.º 2
0
    def add_category_records(self, categories, user_id, brab_id):
        category_count = 0
        for categ_id in categories:
            category_count = category_count + 1
            category_link = Category_to_brab(auth_user_id=user_id,
                                             brab_id=brab_id,
                                             category_id=categ_id)

            category_link.save()

        return category_count
Exemplo n.º 3
0
    def add_category_records(self, categories, user_id, brab_id):
    #        Delete existing category links
        Category_to_brab.objects.filter(brab_id = brab_id).delete()
    #        Re-create category links based on the updated information in the POST
        category_count = 0
        for categ_id in categories:
            category_count = category_count + 1
            if not Category_to_brab.objects.filter(brab_id = brab_id, category_id = categ_id):
                category_link = Category_to_brab(auth_user_id = user_id, brab_id = brab_id, category_id = categ_id)
                category_link.save()

        return category_count
Exemplo n.º 4
0
    def add_category_records(self, categories, user_id, brab_id):
        #        Delete existing category links
        Category_to_brab.objects.filter(brab_id=brab_id).delete()
        #        Re-create category links based on the updated information in the POST
        category_count = 0
        for categ_id in categories:
            category_count = category_count + 1
            if not Category_to_brab.objects.filter(brab_id=brab_id,
                                                   category_id=categ_id):
                category_link = Category_to_brab(auth_user_id=user_id,
                                                 brab_id=brab_id,
                                                 category_id=categ_id)
                category_link.save()

        return category_count