cremcrem2devdev2diademsgenericinstru_searchlamnlivemultiproductionrelease/1.4.4securitysocialstoragetest
|
Last change
on this file since c8cdfbe was
c8cdfbe,
checked in by yomguy <yomguy@…>, 13 months ago
|
|
add migrations, fix format
|
-
Property mode set to
100644
|
|
File size:
787 bytes
|
| Line | |
|---|
| 1 | from optparse import make_option |
|---|
| 2 | from django.conf import settings |
|---|
| 3 | from django.core.management.base import BaseCommand, CommandError |
|---|
| 4 | from django.contrib.auth.models import User |
|---|
| 5 | from django.template.defaultfilters import slugify |
|---|
| 6 | from telemeta.models import * |
|---|
| 7 | from telemeta.util.unaccent import unaccent |
|---|
| 8 | import logging |
|---|
| 9 | import codecs |
|---|
| 10 | |
|---|
| 11 | class Command(BaseCommand): |
|---|
| 12 | help = "Init original formats from a txt file (see files in example/init/" |
|---|
| 13 | args = "path" |
|---|
| 14 | admin_email = 'webmaster@parisson.com' |
|---|
| 15 | |
|---|
| 16 | def handle(self, *args, **options): |
|---|
| 17 | path = args[0] |
|---|
| 18 | file = open(path, 'r') |
|---|
| 19 | for format in file.readlines(): |
|---|
| 20 | if not OriginalFormat.objects.filter(value=format): |
|---|
| 21 | format = OriginalFormat(value=format) |
|---|
| 22 | format.save() |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.