1 # -*- coding: utf-8 -*-
3 from south.db import db
4 from django.db import models
5 from catalogue.models import Tag, Book
10 "Write your forwards migration here"
11 for tag in Tag.objects.filter(user__isnull=False):
12 books = Tag.intermediary_table_model.objects.get_intersection_by_model(Book, [tag])
13 tag.book_count = len(books)
16 def backwards(self, orm):
17 "Write your backwards migration here"