import HTMLParser
parser = HTMLParser.HTMLParser()
+import mezzanine.blog.models as blog_models
+
-# Label
-label_set = set([shop.label for shop in rec_models.Shop.objects.all()])
-count = 0
-for lab in label_set:
- obj, created = rec_models.Label.objects.get_or_create(name = lab)
- if created:
- print "Create new Label : %s" % obj.name
- count += 1
-print '--------------------------------------'
-print "%d created label objects" % count
-print "%d label in new db / %d in old db" % (len(rec_models.Label.objects.all()), len(label_set))
-print '--------------------------------------'
+def populate_label():
+ # Label
+ label_set = set([shop.label for shop in rec_models.Shop.objects.all()])
+ count = 0
+ for lab in label_set:
+ obj, created = rec_models.Label.objects.get_or_create(name = lab)
+ if created:
+ print "Create new Label : %s" % obj.name
+ count += 1
+ print '--------------------------------------'
+ print "%d created label objects" % count
+ print "%d label in new db / %d in old db" % (len(rec_models.Label.objects.all()), len(label_set))
+ print '--------------------------------------'
+
+ return
# Artist
-artist_set = set([shop.artiste for shop in rec_models.Shop.objects.all()])
-count = 0
-for artist in artist_set:
- obj, created = rec_models.Artist.objects.get_or_create(name = artist)
- if created:
- print "Create new Artist : %s" % obj.name
- count += 1
+def populate_artist():
+ artist_set = set([shop.artiste for shop in rec_models.Shop.objects.all()])
+ count = 0
+ for artist in artist_set:
+ obj, created = rec_models.Artist.objects.get_or_create(name = artist)
+ if created:
+ print "Create new Artist : %s" % obj.name
+ count += 1
+
+ print '--------------------------------------'
+ print "%d created artist object" % count
+ print "%d artist in new db / %d in old db" % (len(rec_models.Artist.objects.all()), len(artist_set))
+ print '--------------------------------------'
-print '--------------------------------------'
-print "%d created artist object" % count
-print "%d artist in new db / %d in old db" % (len(rec_models.Artist.objects.all()), len(artist_set))
-print '--------------------------------------'
+ return
-# Pays
-country_set = set([shop.pays for shop in rec_models.Shop.objects.all()])
-count = 0
-for country in country_set:
- obj, created = rec_models.Country.objects.get_or_create(name = country)
- if created:
- print "Create new Country : %s" % obj.name
- count += 1
+# Country
+def populate_country(
+ country_set = set([shop.pays for shop in rec_models.Shop.objects.all()])
+ count = 0
+ for country in country_set:
+ obj, created = rec_models.Country.objects.get_or_create(name = country)
+ if created:
+ print "Create new Country : %s" % obj.name
+ count += 1
-print '--------------------------------------'
-print "%d created country object" % count
-print "%d country in new db / %d in old db" % (len(rec_models.Country.objects.all()), len(country_set))
-print '--------------------------------------'
+ print '--------------------------------------'
+ print "%d created country object" % count
+ print "%d country in new db / %d in old db" % (len(rec_models.Country.objects.all()), len(country_set))
+ print '--------------------------------------'
+ return
# Theme
[theme for theme in rec_models.Theme.objects.all()]
# PODCAST FROM MIX
+MIX_CATEGORY = 'Podcast'
+blog_models.BlogCategory.objects.get_or_create(title='Podcast')
+
PODCAST_IMG_PATH = os.path.join('uploads/blog/mixes')
PODCAST_AUDIO_PATH = os.path.join('uploads/audio/mixes')
from django.contrib.auth import models as auth_models
# NEWS
news_list = [news for news in rec_models.News.objects.all()]
+blog_models.BlogCategory.objects.get_or_create(title='News')
# GRADING
## """
## Model for Record
## """
+
+if __name__ == '__main__':
+ pass