diff --git a/README.md b/README.md index 5494c583805a746b813ac4ed46c7ff9525dfa8c4..bf25d9b01dd82e2a0c3f91b22fef84544756ee6b 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,11 @@ When implementing authentication in your own application, you have two options: Please see the [Authentication guide](https://git.startinblox.com/djangoldp-packages/djangoldp/wikis/guides/authentication) for full information -If you're going to use your own model then your user model must extend `DjangoLDP.Model`, or define a `urlid` field on the user model, for example: +If you're going to use your own model then for federated login to work your user model must extend `DjangoLDP.Model`, or define a `urlid` field on the user model, for example: ```python urlid = LDPUrlField(blank=True, null=True, unique=True) ``` +If you don't include this field, then all users will be treated as users local to your instance The `urlid` field is used to uniquely identify the user and is part of the Linked Data Protocol standard. For local users it can be generated at runtime, but for some resources which are from distant servers this is required to be stored diff --git a/djangoldp/serializers.py b/djangoldp/serializers.py index c4e52fc7e76a6b9044730919058c8b16affea815..65bdc175da10a34e95ad63747b96fc585b7b2a44 100644 --- a/djangoldp/serializers.py +++ b/djangoldp/serializers.py @@ -6,7 +6,7 @@ from urllib import parse from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import ImproperlyConfigured -from django.core.exceptions import ValidationError as DjangoValidationError, FieldDoesNotExist +from django.core.exceptions import ValidationError as DjangoValidationError from django.core.urlresolvers import get_resolver, resolve, get_script_prefix, Resolver404 from django.db.models import QuerySet from django.utils.datastructures import MultiValueDictKeyError @@ -626,9 +626,6 @@ class LDPSerializer(HyperlinkedModelSerializer): elif hasattr(field_model, 'urlid'): kwargs = {'urlid': field_dict['urlid']} sub_inst = field_model.objects.get(**kwargs) - else: - raise FieldDoesNotExist( - 'model ' + str(field_model) + ' lacked urlid field, but urlid was submitted') # try slug field, assuming that this is a local resource elif slug_field in field_dict: kwargs = {slug_field: field_dict[slug_field]} @@ -720,9 +717,6 @@ class LDPSerializer(HyperlinkedModelSerializer): elif hasattr(field_model, 'urlid'): kwargs = {'urlid': item['urlid']} saved_item = self.get_or_create(field_model, item, kwargs) - else: - raise FieldDoesNotExist( - 'model ' + str(field_model) + ' lacked urlid field, but urlid was submitted') else: rel = getattr(instance._meta.model, field_name).rel try: