Tags » Django

Django views

RetrieveUpdateDestroyAPIView will do all the CRUD things

class CoinDetailView(RetrieveUpdateDestroyAPIView):
  permission_classes = (IsAuthenticated,)
  serializer_class = CoinSerializer
  queryset = Coin.objects.all()

That’s quick!

http://www.django-rest-framework.org/api-guide/generic-views/#retrieveupdatedestroyapiview

views.py

from .models import Coin
from .serializer import CoinSerializer

class CoinViewSet(mixins.createModelMixin, mixins.ListModelMixin, mixins.UpdateModeMixin, mixins.RetrieveModelMixin, mixins.DestroyModelMixin, viewsets.GenericViewSet):
  #stuff… 49 more words
Programming

GraphQL in the Wild...

GraphQL is an interesting technology with a lot of good points, but some drawbacks.

Pros:

  • Self explorable
  • easy documentation
  • intuitive
  • simplifies client side logic

Cons: 515 more words

Programming

Let the Programming Begin!

The exciting time of putting code to PyDev has officially begun. I gathered a few of my existing books together and then after an exhaustive search online decided on a few more to round out what I would need to help me. 440 more words

Python

Django User Scenarios

#1 Proxy Model

Create an alias to an existing model.

Good: Custom model manager, custom model methods

Limitations: Can’t add additional attributes, can’t change the database… 243 more words

Programming

Django on Lambda

Use a project called zappa that makes it easy!

Gotcha #1 : Security!  ALLOWED_HOSTS

Automatically generated or subdomain added to ALLOWED_HOSTS

Gotcha #2: Static Files… 108 more words

Programming

My Python & Django Learning Introduction:

Python is one of the most widely used programming languages with rich history. As I always wanted to post some things related to the learning I did for the week, hereby keep posting details in the same area. 182 more words

Python

Mayan-Edms IOError: [Errno 13] Permission denied

Here is what to do when faced with an error resembling the following:


/usr/share/mayan-edms/lib/python2.7/site-packages/ to pythonpath.
Traceback (most recent call last):
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/wsgi.py", line 16, in 
application = get_wsgi_application()
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/checkouts/apps.py", line 29, in 
from .tasks import task_check_expired_check_outs # NOQA
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/checkouts/tasks.py", line 8, in 
from lock_manager.runtime import locking_backend
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/lock_manager/runtime.py", line 5, in 
locking_backend = import_string(setting_backend.value)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/lock_manager/backends/file_lock.py", line 25, in 
open(lock_file, 'a').close()
IOError:  Permission denied: u'/tmp/mayan_locks.tmp'
unable to load app 0 (mountpoint='') (callable not found or import e
… 22 more words
Django