2015-03-23 15:36:51 +00:00
|
|
|
from django.apps import AppConfig
|
|
|
|
from django.contrib.contenttypes.fields import GenericRelation
|
|
|
|
|
2015-05-07 14:09:37 +00:00
|
|
|
from orchestra.core import services
|
2015-05-06 19:30:13 +00:00
|
|
|
from orchestra.utils.db import database_ready
|
2015-03-23 15:36:51 +00:00
|
|
|
|
|
|
|
|
2015-05-07 14:09:37 +00:00
|
|
|
class WebsitesConfig(AppConfig):
|
2015-04-05 10:46:24 +00:00
|
|
|
name = 'orchestra.contrib.websites'
|
2015-03-23 15:36:51 +00:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
if database_ready():
|
2015-05-07 14:09:37 +00:00
|
|
|
# from django.contrib.contenttypes.models import ContentType
|
|
|
|
# from .models import Content, Website
|
|
|
|
# qset = Content.content_type.field.get_limit_choices_to()
|
|
|
|
# for ct in ContentType.objects.filter(qset):
|
|
|
|
# relation = GenericRelation('websites.Content')
|
|
|
|
# ct.model_class().add_to_class('content_set', relation)
|
|
|
|
from .models import Website
|
|
|
|
services.register(Website, icon='Applications-internet.png')
|