Skip to content
Advertisement

Tag: django

When are create and update called in djangorestframework serializer?

I’m currently implementing djangorestframework for my app RESTful API. After playing around with it, I still do not clearly understand what .create(self, validated_data) and .update(self, validated_data) used for in the serializer. As I understand, CRUD only calls the 4 main methods in viewsets.ModelViewSet: create(), retrive(), update(), and destroy(). I also have already tried to debug and print out stuff to

Setting up MongoDB + Django

I am new to Mongo DB and Django. I’ve been trying to use Mongo DB as my primary Database for Django. I’ve installed MongoDB and Django-nonrel as per the following link: Django – MongoDB setup The version of django-nonrel, i am using is 1.7. Clone link to it: pip install git+https://github.com/django-nonrel/django@nonrel-1.7 After following all steps, my settings.py in the django

Django error: relation “users_user” does not exist

I’m getting the following error during migration: django.db.utils.ProgrammingError: relation “users_user” does not exist This is my model: Settings: Anything I have missed? Answer Inside your user app, you should have a folder migrations. It should only contain 0001_initial.py and __init__.py. Is that correct? Try running ./manage.py sqlmigrate user 0001_initial and see what it does, because thats where the error comes

How to run tests django rest framework tests?

I’m learning django rest framework. I wrote a simple test like this: my api returns empty json array for that request. What i don’t know is, how do i run this test? when i use this command: i get as output. It’s not written in documentation to how to run the tests. Answer I believe your test methods need to

Advertisement