Commit b871f179ed0f4d4274fb8466d6031d888d7534c8
1 parent
f90d447a
Exists in
master
and in
79 other branches
Updated CommunityAssociations model and added to admin
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Showing
2 changed files
with
8 additions
and
19 deletions
Show diff stats
colab_spb/admin.py
colab_spb/models.py
1 | +from colab.plugins.gitlab import models as gitlab | |
2 | +from colab.plugins.noosfero import models as noosfero | |
1 | 3 | from colab.super_archives import models as mailman |
2 | -from django.conf import settings | |
3 | 4 | from django.db import models |
4 | -import importlib | |
5 | -from sys import modules | |
6 | - | |
7 | -# Create your models here. | |
8 | -# Import plugins models | |
9 | -for app in settings.COLAB_APPS: | |
10 | - if app != 'colab_spb': | |
11 | - plugin_name = app.split('.')[-1] | |
12 | - # Create alias to plugins | |
13 | - exec "%s = importlib.import_module('%s.models')" % (plugin_name, app) | |
14 | 5 | |
15 | 6 | |
16 | 7 | class CommunityAssociations(models.Model): |
17 | - community = models.ForeignKey(noosfero.NoosferoCommunity) \ | |
18 | - if 'noosfero' in modules else None | |
19 | - | |
20 | - repository = models.ForeignKey(gitlab.GitlabProject) \ | |
21 | - if 'gitlab' in modules else None | |
22 | - | |
8 | + community = models.ForeignKey(noosfero.NoosferoCommunity, null=True) | |
9 | + group = models.ForeignKey(gitlab.GitlabGroup, null=True) | |
23 | 10 | mail_list = models.ForeignKey(mailman.MailingList, null=True) | ... | ... |