From fb517d697f1096fab3b2f22de3bde6c4f401ecc4 Mon Sep 17 00:00:00 2001 From: hao555sky <836095186@qq.com> Date: Sun, 11 Jun 2017 17:42:17 +0800 Subject: [PATCH] implement the Forking this Concept and mapping --- django-nonrel/ocl/collection/models.py | 1 + django-nonrel/ocl/collection/views.py | 5 ++ django-nonrel/ocl/concepts/models.py | 10 ++++ django-nonrel/ocl/concepts/serializers.py | 65 ++++++++++++++++++++++- django-nonrel/ocl/concepts/views.py | 42 ++++++++++++++- django-nonrel/ocl/mappings/models.py | 6 ++- django-nonrel/ocl/mappings/serializers.py | 8 +++ django-nonrel/ocl/oclapi/models.py | 5 +- django-nonrel/ocl/oclapi/views.py | 4 ++ django-nonrel/ocl/sources/serializers.py | 7 ++- django-nonrel/ocl/sources/urls.py | 6 ++- django-nonrel/ocl/tasks.py | 2 + django-nonrel/ocl/user_urls.py | 6 ++- 13 files changed, 160 insertions(+), 7 deletions(-) diff --git a/django-nonrel/ocl/collection/models.py b/django-nonrel/ocl/collection/models.py index 76ea0a2..df0417a 100644 --- a/django-nonrel/ocl/collection/models.py +++ b/django-nonrel/ocl/collection/models.py @@ -425,6 +425,7 @@ def propagate_owner_status(sender, instance=None, created=False, **kwargs): class CollectionReferenceUtils(): @classmethod def get_all_related_mappings(cls, expressions, collection): + all_related_mappings = [] unversioned_mappings = concept_expressions = [] diff --git a/django-nonrel/ocl/collection/views.py b/django-nonrel/ocl/collection/views.py index 2e654ac..b8b15ac 100644 --- a/django-nonrel/ocl/collection/views.py +++ b/django-nonrel/ocl/collection/views.py @@ -102,6 +102,7 @@ class CollectionReferencesView(CollectionBaseView, serializer_class = CollectionDetailSerializer def initialize(self, request, path_info_segment, **kwargs): + if request.method in ['GET', 'HEAD']: self.permission_classes = (CanViewConceptDictionary,) else: @@ -112,6 +113,7 @@ def get_level(self): return 1 def update(self, request, *args, **kwargs): + if not self.parent_resource: return HttpResponse(status=status.HTTP_405_METHOD_NOT_ALLOWED) @@ -162,6 +164,7 @@ def create_success_message(self, added_references, expression): message = self.select_update_message(expression) references = filter(lambda reference: reference.startswith(expression), added_references) + if len(references) < 1: return @@ -211,6 +214,7 @@ def destroy(self, request, *args, **kwargs): return Response({'message': 'ok!'}, status=status.HTTP_200_OK) def get_related_mappings_with_version_information(self, cascade_mappings_flag, references): + related_mappings = [] for reference in references: @@ -248,6 +252,7 @@ def select_update_message(self, expression): return self.adding_to_head_message_by_type(resource_type) resource_name = expression_parts[6] + return self.version_added_message_by_type(resource_name, self.parent_resource.name, resource_type) def adding_to_head_message_by_type(self, resource_type): diff --git a/django-nonrel/ocl/concepts/models.py b/django-nonrel/ocl/concepts/models.py index 45fde4f..93bd6d8 100644 --- a/django-nonrel/ocl/concepts/models.py +++ b/django-nonrel/ocl/concepts/models.py @@ -58,6 +58,10 @@ class Concept(ConceptValidationMixin, SubResourceBaseModel, DictionaryItemMixin) descriptions = ListField(EmbeddedModelField(LocalizedText), null=True, blank=True) retired = models.BooleanField(default=False) + version = models.TextField(null=True, blank=True) + forked_from_url = models.TextField(null=True, blank=True) + forked_concept_version = models.TextField(null=True, blank=True) + objects = MongoDBManager() @@ -226,6 +230,9 @@ class ConceptVersion(ConceptValidationMixin, ResourceVersionModel): version_created_by = models.TextField() update_comment = models.TextField(null=True, blank=True) + forked_from_url = models.TextField(null=True, blank=True) + forked_concept_version = models.TextField(null=True, blank=True) + objects = MongoDBManager() def clone(self): @@ -376,6 +383,8 @@ def for_concept(cls, concept, label, previous_version=None, parent_version=None) version_created_by=concept.created_by, created_by=concept.created_by, updated_by=concept.updated_by, + forked_from_url=concept.forked_from_url, + forked_concept_version=concept.forked_concept_version ) @classmethod @@ -519,3 +528,4 @@ def propagate_parent_attributes(sender, instance=None, created=False, **kwargs): concept_version.public_access = instance.public_access concept_version.save() concept.save() + diff --git a/django-nonrel/ocl/concepts/serializers.py b/django-nonrel/ocl/concepts/serializers.py index 39745dc..28539ad 100644 --- a/django-nonrel/ocl/concepts/serializers.py +++ b/django-nonrel/ocl/concepts/serializers.py @@ -44,12 +44,16 @@ class ConceptDetailSerializer(serializers.Serializer): created_on = serializers.DateTimeField(source='created_at', read_only=True) updated_on = serializers.DateTimeField(source='updated_at', read_only=True) extras = serializers.WritableField(required=False) + version = serializers.CharField(required=False) + forked_concept_version = serializers.CharField(required=False) + forked_from_url = serializers.CharField(required=False) class Meta: model = Concept lookup_field = 'mnemonic' def restore_object(self, attrs, instance=None): + print 'ConceptDetailSerializer attrs: ', attrs concept = instance if instance else Concept() concept.mnemonic = attrs.get(self.Meta.lookup_field, concept.mnemonic) concept.external_id = attrs.get('external_id', concept.external_id) @@ -58,6 +62,9 @@ def restore_object(self, attrs, instance=None): concept.extras = attrs.get('extras', concept.extras) concept.retired = attrs.get('retired', concept.retired) + concept.forked_from_url = attrs.get('forked_from_url', concept.forked_from_url) + concept.forked_concept_version = attrs.get('version', concept.version) + # Is this desired behavior?? concept.names = attrs.get('names', concept.names) @@ -65,6 +72,7 @@ def restore_object(self, attrs, instance=None): concept.descriptions = attrs.get('descriptions', concept.descriptions) concept.extras = attrs.get('extras', concept.extras) + return concept def save_object(self, obj, **kwargs): @@ -73,6 +81,58 @@ def save_object(self, obj, **kwargs): self._errors.update(errors) +# class ConceptForkDetailSerializer(ResourceVersionSerializer): +# id = serializers.CharField(required=True, validators=[RegexValidator(regex=NAMESPACE_REGEX)], source='mnemonic') +# external_id = serializers.CharField(required=False) +# concept_class = serializers.CharField(required=False) +# datatype = serializers.CharField(required=False) +# display_name = serializers.CharField(read_only=True) +# display_locale = serializers.CharField(read_only=True) +# names = LocalizedTextListField(required=False) +# descriptions = LocalizedTextListField(required=False, name_override='description') +# retired = serializers.BooleanField(required=False) +# url = serializers.URLField(read_only=True) +# source = serializers.CharField(source='parent_resource', read_only=True) +# owner = serializers.CharField(source='owner_name', read_only=True) +# owner_type = serializers.CharField(read_only=True) +# owner_url = serializers.URLField(read_only=True) +# created_on = serializers.DateTimeField(source='created_at', read_only=True) +# updated_on = serializers.DateTimeField(source='updated_at', read_only=True) +# extras = serializers.WritableField(required=False) +# version = serializers.CharField(source='mnemonic') +# forked_concept_version = serializers.CharField(required=False) +# forked_from_url = serializers.CharField(required=False) +# +# class Meta: +# model = ConceptVersion +# lookup_field = 'mnemonic' +# +# def restore_object(self, attrs, instance=None): +# print 'ConceptForkDetailSerializer attrs: ', attrs +# concept = instance if instance else ConceptVersion() +# concept.mnemonic = attrs.get(self.Meta.lookup_field, concept.mnemonic) +# concept.external_id = attrs.get('external_id', concept.external_id) +# concept.concept_class = attrs.get('concept_class', concept.concept_class) +# concept.datatype = attrs.get('datatype', concept.datatype) +# concept.extras = attrs.get('extras', concept.extras) +# concept.retired = attrs.get('retired', concept.retired) +# concept.forked_concept_version = concept.mnemonic +# concept.forked_from_url = attrs.get('forked_from_url', concept.forked_from_url) +# +# # Is this desired behavior?? +# concept.names = attrs.get('names', concept.names) +# +# # Is this desired behavior?? +# concept.descriptions = attrs.get('descriptions', concept.descriptions) +# +# concept.extras = attrs.get('extras', concept.extras) +# return concept +# +# def save_object(self, obj, **kwargs): +# request_user = self.context['request'].user +# errors = Concept.persist_new(obj, request_user, **kwargs) +# self._errors.update(errors) + class ConceptVersionsSerializer(serializers.Serializer): version = serializers.CharField(source='mnemonic') @@ -102,6 +162,8 @@ class ConceptVersionListSerializer(ResourceVersionSerializer): mappings = MappingListField(read_only=True) is_latest_version = serializers.CharField() locale = serializers.SerializerMethodField(method_name='get_locale') + forked_concept_version = serializers.CharField() + forked_from_url = serializers.CharField() class Meta: model = ConceptVersion @@ -122,7 +184,6 @@ def __init__(self, *args, **kwargs): mappings_field.source = 'get_empty_mappings' - class ConceptVersionDetailSerializer(ResourceVersionSerializer): type = serializers.CharField(source='versioned_resource_type') uuid = serializers.CharField(source='id') @@ -150,6 +211,8 @@ class ConceptVersionDetailSerializer(ResourceVersionSerializer): mappings = MappingListField(read_only=True) is_latest_version = serializers.CharField() locale = serializers.SerializerMethodField(method_name='get_locale') + forked_from_url = serializers.CharField() + forked_concept_version = serializers.CharField() class Meta: model = ConceptVersion diff --git a/django-nonrel/ocl/concepts/views.py b/django-nonrel/ocl/concepts/views.py index 2e05335..0c0cc13 100644 --- a/django-nonrel/ocl/concepts/views.py +++ b/django-nonrel/ocl/concepts/views.py @@ -8,6 +8,9 @@ DestroyAPIView, RetrieveUpdateDestroyAPIView, CreateAPIView, ListCreateAPIView, ListAPIView) from rest_framework.response import Response + +from collection.models import Collection, CollectionVersion, CollectionReference, CollectionReferenceUtils + from concepts.filters import LimitSourceVersionFilter, PublicConceptsSearchFilter, LimitCollectionVersionFilter from concepts.models import Concept, ConceptVersion, LocalizedText from concepts.permissions import CanViewParentDictionary, CanEditParentDictionary @@ -109,7 +112,7 @@ class ConceptVersionListAllView(BaseAPIView, ConceptVersionCSVFormatterMixin, Li model = ConceptVersion permission_classes = (CanViewParentDictionary,) filter_backends = [PublicConceptsSearchFilter] - queryset = ConceptVersion.objects.filter(is_active=True) + solr_fields = { 'name': {'sortable': True, 'filterable': False}, 'lastUpdate': {'sortable': True, 'filterable': False}, @@ -192,6 +195,43 @@ def create(self, request, *args, **kwargs): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +class ConceptForkView(ConceptBaseView, + mixins.CreateModelMixin): + + @csrf_exempt + def dispatch(self, request, *args, **kwargs): + if request.method != 'POST': + delegate_view = ConceptVersionListView.as_view() + return delegate_view(request, *args, **kwargs) + return super(ConceptForkView, self).dispatch(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + self.permission_classes = (CanEditParentDictionary,) + self.serializer_class = ConceptDetailSerializer + return self.create(request, *args, **kwargs) + + def create(self, request, *args, **kwargs): + serializer = self.get_serializer(data=request.DATA, files=request.FILES) + + if serializer.is_valid(): + self.pre_save(serializer.object) + save_kwargs = { + 'force_insert': True, + 'parent_resource': self.parent_resource, + 'child_list_attribute': self.child_list_attribute + } + self.object = serializer.save(**save_kwargs) + if serializer.is_valid(): + self.post_save(self.object, created=True) + headers = self.get_success_headers(serializer.data) + latest_version = ConceptVersion.get_latest_version_of(self.object) + serializer = ConceptVersionDetailSerializer(latest_version) + return Response(serializer.data, status=status.HTTP_201_CREATED, + headers=headers) + + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + class ConceptVersionsView(ConceptDictionaryMixin, ListWithHeadersMixin): serializer_class = ConceptVersionListSerializer permission_classes = (CanViewParentDictionary,) diff --git a/django-nonrel/ocl/mappings/models.py b/django-nonrel/ocl/mappings/models.py index 8268994..57eef8f 100644 --- a/django-nonrel/ocl/mappings/models.py +++ b/django-nonrel/ocl/mappings/models.py @@ -23,6 +23,7 @@ class Mapping(MappingValidationMixin, BaseModel): to_concept_name = models.TextField(null=True, blank=True) retired = models.BooleanField(default=False) external_id = models.TextField(null=True, blank=True) + is_internal_or_external = models.TextField() class Meta: unique_together = ( @@ -43,6 +44,7 @@ def clone(self, user): to_concept_name=self.to_concept_name, retired=self.retired, external_id=self.external_id, + is_internal_or_external = self.is_internal_or_external, ) @property @@ -355,6 +357,7 @@ class MappingVersion(MappingValidationMixin, ResourceVersionModel): external_id = models.TextField(null=True, blank=True) is_latest_version = models.BooleanField(default=True) update_comment = models.TextField(null=True, blank=True) + is_internal_or_external = models.TextField() def clone(self): return MappingVersion( @@ -373,7 +376,8 @@ def clone(self): previous_version=self, parent_version=self.parent_version, is_latest_version=self.is_latest_version, - extras=self.extras + extras=self.extras, + is_internal_or_external = self.is_internal_or_external ) class Meta: diff --git a/django-nonrel/ocl/mappings/serializers.py b/django-nonrel/ocl/mappings/serializers.py index 7df6257..e0828ee 100644 --- a/django-nonrel/ocl/mappings/serializers.py +++ b/django-nonrel/ocl/mappings/serializers.py @@ -23,6 +23,8 @@ def restore_object(self, attrs, instance=None): mapping.to_concept_name = attrs.get('to_concept_name', mapping.to_concept_name) mapping.to_concept_code = attrs.get('to_concept_code', mapping.to_concept_code) mapping.external_id = attrs.get('external_id', mapping.external_id) + mapping.is_internal_or_external = attrs.get('is_internal_or_external', + mapping.is_internal_or_external) return mapping class Meta: @@ -45,6 +47,8 @@ def restore_object(self, attrs, instance=None): mapping_version.to_concept_name = attrs.get('to_concept_name', mapping_version.to_concept_name) mapping_version.to_concept_code = attrs.get('to_concept_code', mapping_version.to_concept_code) mapping_version.external_id = attrs.get('external_id', mapping_version.external_id) + mapping_version.is_internal_or_external = attrs.get('is_internal_or_external', + mapping_version.is_internal_or_external) return mapping_version class Meta: @@ -57,6 +61,7 @@ class MappingDetailSerializer(MappingBaseSerializer): external_id = serializers.CharField(required=False) retired = serializers.BooleanField(required=False) map_type = serializers.CharField(required=True) + is_internal_or_external = serializers.CharField(required=True) from_source_owner = serializers.CharField(read_only=True) from_source_owner_type = serializers.CharField(read_only=True) @@ -95,6 +100,7 @@ class MappingVersionDetailSerializer(MappingVersionBaseSerializer): external_id = serializers.CharField(required=False) retired = serializers.BooleanField(required=False) map_type = serializers.CharField(required=True) + is_internal_or_external = serializers.CharField(required=True) from_source_owner = serializers.CharField(read_only=True) from_source_owner_type = serializers.CharField(read_only=True) @@ -139,6 +145,7 @@ class MappingListSerializer(MappingBaseSerializer): to_concept_code = serializers.CharField(source='get_to_concept_code') to_concept_name = serializers.CharField(source='get_to_concept_name') url = serializers.CharField(read_only=True) + is_internal_or_external = serializers.CharField(required=True) class MappingVersionListSerializer(ResourceVersionSerializer): @@ -194,6 +201,7 @@ class MappingCreateSerializer(MappingBaseSerializer): to_concept_code = serializers.CharField(required=False) to_concept_name = serializers.CharField(required=False) external_id = serializers.CharField(required=False) + is_internal_or_external = serializers.CharField(required=True) def save_object(self, obj, **kwargs): request_user = self.context['request'].user diff --git a/django-nonrel/ocl/oclapi/models.py b/django-nonrel/ocl/oclapi/models.py index 53c9b87..fe21471 100644 --- a/django-nonrel/ocl/oclapi/models.py +++ b/django-nonrel/ocl/oclapi/models.py @@ -221,6 +221,7 @@ def get_head_of(cls, versioned_object): LOOKUP_CONCEPT_CLASSES = ['Concept Class', 'Datatype', 'NameType', 'DescriptionType', 'MapType', 'Locale'] LOOKUP_SOURCES = ['Classes', 'Datatypes', 'NameTypes', 'DescriptionTypes', 'MapTypes', 'Locales'] + class ConceptContainerModel(SubResourceBaseModel): name = models.TextField() full_name = models.TextField(null=True, blank=True) @@ -230,6 +231,7 @@ class ConceptContainerModel(SubResourceBaseModel): description = models.TextField(null=True, blank=True) external_id = models.TextField(null=True, blank=True) custom_validation_schema = models.TextField(blank=True, null=True) + allow_forking = models.BooleanField(default=False) class Meta(SubResourceBaseModel.Meta): abstract = True @@ -378,6 +380,7 @@ class ConceptContainerVersionModel(ResourceVersionModel): website = models.TextField(null=True, blank=True) description = models.TextField(null=True, blank=True) external_id = models.TextField(null=True, blank=True) + allow_forking = models.BooleanField(default=False) class Meta(ResourceVersionModel.Meta): abstract = True @@ -516,4 +519,4 @@ def stamp_uri(sender, instance, **kwargs): if hasattr(instance, 'versioned_object'): instance.uri = reverse_resource_version(instance, instance.view_name) else: - instance.uri = reverse_resource(instance, instance.view_name) + instance.uri = reverse_resource(instance, instance.view_name) \ No newline at end of file diff --git a/django-nonrel/ocl/oclapi/views.py b/django-nonrel/ocl/oclapi/views.py index 9a23e3a..34b33c3 100644 --- a/django-nonrel/ocl/oclapi/views.py +++ b/django-nonrel/ocl/oclapi/views.py @@ -331,6 +331,10 @@ def get_queryset(self): queryset = super(ResourceVersionMixin, self).get_queryset() versioned_object_type = ContentType.objects.get_for_model(self.versioned_object) queryset = queryset.filter(versioned_object_type__pk=versioned_object_type.id, versioned_object_id=self.versioned_object.id) + + print 'ResourceVersionMixin versioned_object_type: ', versioned_object_type + print 'ResourceVersionMixin queryset: ', queryset + return queryset diff --git a/django-nonrel/ocl/sources/serializers.py b/django-nonrel/ocl/sources/serializers.py index 90eb290..ecdbe8c 100644 --- a/django-nonrel/ocl/sources/serializers.py +++ b/django-nonrel/ocl/sources/serializers.py @@ -14,6 +14,7 @@ class SourceListSerializer(serializers.Serializer): + id = serializers.CharField(required=True, validators=[RegexValidator(regex=NAMESPACE_REGEX)], source='mnemonic') short_code = serializers.CharField(required=True, source='mnemonic') name = serializers.CharField(required=True) url = serializers.CharField() @@ -44,6 +45,7 @@ def restore_object(self, attrs, instance=None): source.supported_locales = attrs.get('supported_locales').split(',') if attrs.get('supported_locales') else source.supported_locales source.extras = attrs.get('extras', source.extras) source.external_id = attrs.get('external_id', source.external_id) + source.allow_forking = attrs.get('allow_forking', source.allow_forking) return source def get_active_concepts(self, obj): @@ -121,6 +123,7 @@ class SourceDetailSerializer(SourceCreateOrUpdateSerializer): updated_by = serializers.CharField(read_only=True) extras = serializers.WritableField(required=False) external_id = serializers.CharField(required=False) + allow_forking = serializers.BooleanField(required=True) def save_object(self, obj, **kwargs): request_user = self.context['request'].user @@ -165,6 +168,7 @@ class SourceVersionDetailSerializer(ResourceVersionSerializer): external_id = serializers.CharField(required=False) active_mappings = serializers.IntegerField(required=False) active_concepts = serializers.IntegerField(required=False) + allow_forking = serializers.BooleanField(required=True) class Meta: model = SourceVersion @@ -189,6 +193,7 @@ def to_native(self, obj): ret['_ocl_processing'] = True return ret + class SourceVersionExportSerializer(ResourceVersionSerializer): type = serializers.CharField(required=True, source='resource_type') id = serializers.CharField(required=True, source='mnemonic') @@ -287,4 +292,4 @@ def save_object(self, obj, **kwargs): if errors: self._errors.update(errors) else: - update_children_for_resource_version.delay(obj.id, 'source') + update_children_for_resource_version.delay(obj.id, 'source') \ No newline at end of file diff --git a/django-nonrel/ocl/sources/urls.py b/django-nonrel/ocl/sources/urls.py index 5375542..5ab600f 100644 --- a/django-nonrel/ocl/sources/urls.py +++ b/django-nonrel/ocl/sources/urls.py @@ -1,12 +1,16 @@ from django.conf.urls import patterns, url, include +from concepts.views import ConceptForkView, ConceptCreateView from sources.feeds import SourceFeed -from sources.views import SourceListView, SourceRetrieveUpdateDestroyView, SourceVersionRetrieveUpdateView, SourceVersionChildListView, SourceVersionListView, SourceVersionRetrieveUpdateDestroyView, SourceExtrasView, SourceExtraRetrieveUpdateDestroyView, SourceVersionExportView +from sources.views import SourceListView, SourceRetrieveUpdateDestroyView, SourceVersionRetrieveUpdateView, \ + SourceVersionChildListView, SourceVersionListView, SourceVersionRetrieveUpdateDestroyView, SourceExtrasView, \ + SourceExtraRetrieveUpdateDestroyView, SourceVersionExportView __author__ = 'misternando' urlpatterns = patterns('', url(r'^$', SourceListView.as_view(), name='source-list'), url(r'^(?P[a-zA-Z0-9\-\.]+)/$', SourceRetrieveUpdateDestroyView.as_view(), name='source-detail'), + url(r'^(?P[a-zA-Z0-9\-\.]+)/forking/$', ConceptForkView.as_view(), name='concept-fork'), url(r'^(?P[a-zA-Z0-9\-\.]+)/atom/$', SourceFeed()), url(r'^(?P[a-zA-Z0-9\-\.]+)/versions/$', SourceVersionListView.as_view(), name='sourceversion-list'), url(r'^(?P[a-zA-Z0-9\-\.]+)/latest/$', SourceVersionRetrieveUpdateView.as_view(), {'is_latest': True}, name='sourceversion-latest-detail'), diff --git a/django-nonrel/ocl/tasks.py b/django-nonrel/ocl/tasks.py index 4f3478b..2ce637d 100644 --- a/django-nonrel/ocl/tasks.py +++ b/django-nonrel/ocl/tasks.py @@ -118,6 +118,7 @@ def delete_resources_from_collection_in_solr(version_id, concepts, mappings): @celery.task def add_references(SerializerClass, user, data, parent_resource, host_url, cascade_mappings=False): + expressions = data.get('expressions', []) concept_expressions = data.get('concepts', []) mapping_expressions = data.get('mappings', []) @@ -178,6 +179,7 @@ def add_references(SerializerClass, user, data, parent_resource, host_url, casca diff = map(lambda ref: ref, CollectionReference.diff(serializer.object.references, prev_refs)) errors = serializer.errors.get('references', []) + return diff, errors diff --git a/django-nonrel/ocl/user_urls.py b/django-nonrel/ocl/user_urls.py index 563fb99..9a1f6eb 100644 --- a/django-nonrel/ocl/user_urls.py +++ b/django-nonrel/ocl/user_urls.py @@ -1,5 +1,8 @@ from django.conf.urls import patterns, url, include -from concepts.views import ConceptCreateView, ConceptRetrieveUpdateDestroyView, ConceptVersionRetrieveView, ConceptVersionsView, ConceptNameRetrieveUpdateDestroyView, ConceptNameListCreateView, ConceptDescriptionRetrieveUpdateDestroyView, ConceptDescriptionListCreateView, ConceptExtrasView, ConceptExtraRetrieveUpdateDestroyView, ConceptMappingsView +from concepts.views import ConceptCreateView, ConceptRetrieveUpdateDestroyView, ConceptVersionRetrieveView, \ + ConceptVersionsView, ConceptNameRetrieveUpdateDestroyView, ConceptNameListCreateView, \ + ConceptDescriptionRetrieveUpdateDestroyView, ConceptDescriptionListCreateView, ConceptExtrasView, \ + ConceptExtraRetrieveUpdateDestroyView, ConceptMappingsView, ConceptForkView from mappings.views import MappingListView, MappingDetailView, MappingVersionDetailView, MappingVersionsListView from orgs.views import OrganizationListView from sources.views import SourceListView, SourceRetrieveUpdateDestroyView, SourceVersionRetrieveUpdateView, SourceVersionChildListView, SourceVersionListView, SourceVersionRetrieveUpdateDestroyView @@ -15,6 +18,7 @@ url(r'^orgs/$', OrganizationListView.as_view(), extra_kwargs, name='user-organization-list'), url(r'^sources/$', SourceListView.as_view(), extra_kwargs, name='user-source-list'), url(r'^sources/(?P[a-zA-Z0-9\-\.]+)/$', SourceRetrieveUpdateDestroyView.as_view(), extra_kwargs, name='user-source-detail'), + url(r'^sources/(?P[a-zA-Z0-9\-\.]+)/forking/$', ConceptForkView.as_view(), extra_kwargs, name='concept-fork'), url(r'^sources/(?P[a-zA-Z0-9\-\.]+)/concepts/$', ConceptCreateView.as_view(), name='concept-list'), url(r'^sources/(?P[a-zA-Z0-9\-\.]+)/concepts/(?P[a-zA-Z0-9\-\.]+)/$', ConceptRetrieveUpdateDestroyView.as_view(), name='concept-detail'), url(r'^sources/(?P[a-zA-Z0-9\-\.]+)/concepts/(?P[a-zA-Z0-9\-\.]+)/descriptions/$', ConceptDescriptionListCreateView.as_view(), name='concept-descriptions'),