From 6922e9d8584f809f34b1553267acc2c10f68aa02 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Thu, 23 Jan 2014 19:44:59 +0100 Subject: [PATCH] Minor --- dusken/api/address.py | 5 +++++ dusken/models.py | 3 +++ dusken/settings-sample.py | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/dusken/api/address.py b/dusken/api/address.py index 1e60138..7f39386 100644 --- a/dusken/api/address.py +++ b/dusken/api/address.py @@ -11,3 +11,8 @@ class AddressResource(ModelResource): resource_name = 'address' authorization = MyDjangoAuthorization() authentication = OAuth20Authentication() + + def dehydrate(self, bundle): + bundle.data['full'] = bundle.obj.full + + return bundle diff --git a/dusken/models.py b/dusken/models.py index 17cc3d0..b754d70 100644 --- a/dusken/models.py +++ b/dusken/models.py @@ -99,6 +99,9 @@ class Address(AbstractBaseModel): city = models.CharField(max_length=100) country = models.ForeignKey('dusken.Country', null=True, blank=True) + @property + def full(self): + return self.__unicode__() class Country(AbstractBaseModel): class Meta: diff --git a/dusken/settings-sample.py b/dusken/settings-sample.py index b30a27f..5602f7d 100644 --- a/dusken/settings-sample.py +++ b/dusken/settings-sample.py @@ -97,12 +97,19 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ +STATIC_ROOT = 'staticfiles' STATIC_URL = '/static/' +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, 'static'), +) + # Our own User class used for authentication. AUTH_USER_MODEL = 'dusken.Member' TASTYPIE_DEFAULT_FORMATS = ['json'] +TASTYPIE_DATETIME_FORMATTING = 'iso-8601-strict' # no microseconds +#TASTYPIE_FULL_DEBUG = True CORS_ORIGIN_ALLOW_ALL = True # Allow Ajax calls only from tuple of domain:port