summaryrefslogtreecommitdiff
path: root/ensure_projects.py
blob: 061a413ca0534f9ecf9a10143da9e55571548713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/python3

from bin import django_setup
from django.conf import settings
from patchwork.models import Project

django_setup()  # must be called to get sys.path and django settings in place

for p in settings.DEFAULT_PROJECTS:
    try:
        Project.objects.get(linkname=p['linkname'])
    except Exception:
        print('Creating project: %s' % p['linkname'])
        Project.objects.create(**p)