Skip to content

Instantly share code, notes, and snippets.

View PCreations's full-sized avatar

Pierre Criulanscy PCreations

View GitHub Profile
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = CONFIG_ROOT + MEDIA_URL
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
Operations to perform:
Synchronize unmigrated apps: messages, staticfiles
Apply all migrations: contenttypes, auth, sessions, admin
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
DJANGO_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
THIRD_PARTY_APPS = (
from .base import *
THIRD_PARTY_APPS += ('third.party.package.needed.in.test.env',)
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + PROJECT_APPS
from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
if settings.SERVE_LOCAL_MEDIA:
from decimal import Decimal
from django.db import models
from django.utils.translation import ugettext_lazy as _
VAT_CHOICES = (
(Decimal("0.00"), '0%'),
(Decimal("2.10"), '2.1%'),
(Decimal("5.50"), '5.5%'),
#listing all Option objects
GET /options/
#listing all Service objects
GET /services/
#adding a new Option object
POST /options/
#adding a new Service object
@PCreations
PCreations / gist:39296bfe6db5925be663
Last active August 29, 2015 14:25
HyperlinkedNestedRelatedField
class HyperlinkedNestedRelatedField(HyperlinkedRelatedField):
def __init__(self, view_name, additional_reverse_kwargs, **kwargs):
super(HyperlinkedNestedRelatedField, self).__init__(
view_name,
read_only=True,
**kwargs
)
self.additional_reverse_kwargs = additional_reverse_kwargs