1# -*- coding: utf-8 -*- 

2 

3from django.db import models, migrations 

4 

5 

6def forwards_func(apps, schema_editor): 

7 # We get the model from the versioned app registry; 

8 # if we directly import it, it'll be the wrong version 

9 Keyword = apps.get_model('core', 'Keyword') 

10 Architecture = apps.get_model('core', 'Architecture') 

11 MailingList = apps.get_model('core', 'MailingList') 

12 db_alias = schema_editor.connection.alias 

13 Keyword.objects.using(db_alias).bulk_create([ 

14 Keyword(name='default', default=True), 

15 Keyword(name='bts', default=True), 

16 Keyword(name='bts-control', default=True), 

17 Keyword(name='summary', default=True), 

18 Keyword(name='upload-source', default=True), 

19 Keyword(name='archive', default=True), 

20 Keyword(name='contact', default=True), 

21 Keyword(name='build', default=True), 

22 Keyword(name='vcs', default=False), 

23 Keyword(name='translation', default=False), 

24 Keyword(name='upload-binary', default=False), 

25 Keyword(name='derivatives', default=False), 

26 Keyword(name='derivatives-bugs', default=False), 

27 ]) 

28 Architecture.objects.using(db_alias).bulk_create([ 

29 Architecture(name='amd64'), 

30 Architecture(name='armel'), 

31 Architecture(name='armhf'), 

32 Architecture(name='hurd-i386'), 

33 Architecture(name='i386'), 

34 Architecture(name='ia64'), 

35 Architecture(name='kfreebsd-amd64'), 

36 Architecture(name='kfreebsd-i386'), 

37 Architecture(name='mips'), 

38 Architecture(name='mipsel'), 

39 Architecture(name='powerpc'), 

40 Architecture(name='s390'), 

41 Architecture(name='s390x'), 

42 Architecture(name='sparc'), 

43 Architecture(name='all'), 

44 Architecture(name='any'), 

45 ]) 

46 MailingList.objects.using(db_alias).bulk_create([ 

47 MailingList(name='debian', domain='lists.debian.org', 

48 archive_url_template='https://lists.debian.org/{user}/'), 

49 MailingList(name='alioth-debian', domain='lists.alioth.debian.org', 

50 archive_url_template='https://lists.alioth.debian.org/pipermail/{user}/'), 

51 MailingList(name='ubuntu', domain='lists.ubuntu.com', 

52 archive_url_template='https://lists.ubuntu.com/archives/{user}/'), 

53 MailingList(name='riseup', domain='lists.riseup.net', 

54 archive_url_template='https://lists.riseup.net/www/arc/{user}'), 

55 MailingList(name='launchpad', domain='lists.launchpad.net', 

56 archive_url_template='https://lists.launchpad.net/{user}/'), 

57 MailingList(name='freedesktop', domain='lists.freedesktop.org', 

58 archive_url_template='https://lists.freedesktop.org/archives/{user}/'), 

59 ]) 

60 

61 

62class Migration(migrations.Migration): 

63 

64 dependencies = [ 

65 ('core', '0001_initial'), 

66 ] 

67 

68 operations = [ 

69 migrations.RunPython( 

70 forwards_func, 

71 ), 

72 ]