Giter Site home page Giter Site logo

surveys_system's Introduction

Django Test App

Building

It is best to use the python virtualenv tool to build locally:

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver

Server running on http://localhost:8000

URLs

# getting authorization token
http://localhost:8000/api/token/
    POST
        data = {
            "username": "username",
            "password": "password"
        }

# admin urls
http://localhost:8000/api/admin_surveys/<int:pk>/ - detail survey [GET, DELETE, PUT]
http://localhost:8000/api/admin_surveys/ - list of all surveys [GET, POST]
    POST(add new survey)
        data = {
            "name": "test one",
            "start_date": "2020-12-18",
            "end_date": "2020-12-19",
            "description": "description",
            "questions": [
                {
                    "name": "Your name?",
                    "question_type": "TEXT"
                },
                {
                    "name": "python or c#",
                    "question_type": "CHOICE",
                    "choices": [
                        {
                            "text": "python"
                        },
                        {
                            "text": "c#"
                        }
                    ]
                },
                {
                    "name": "select birds",
                    "question_type": "MULTIPLE_CHOICE",
                    "choices": [
                        {
                            "text": "pigeon"
                        },
                        {
                            "text": "tiger"
                        },
                        {
                            "text": "eagle"
                        }
                    ]
                }
            ]
        }


# client urls
http://localhost:8000/api/client_surveys/?user_id=1 - list of all surveys [GET]
http://localhost:8000/api/client_surveys/completed_surveys/?user_id=1 - completed surveys [GET]
http://localhost:8000/api/client_surveys/<int:pk>/?user_id=1 - detail survey(if completed with ansewers) [GET]
http://localhost:8000/api/client_surveys/<int:pk>/response/?user_id=1 - response to the survey [POST]
    POST(response)
    data = {
        "answers": [
            {
                "pk": 19,
                "answer": {
                    "text": "Alex"
                },
                "question_type": "TEXT"
            },
            {
                "pk": 8,
                "answer": {
                    "pk": 7,
                    "text": "python"
                },
                "question_type": "CHOICE"
            },
            {
                "pk": 3,
                "question_type": "MULTIPLE_CHOICE",
                "answer": [
                    {
                        "pk": 6,
                        "text": "pigeon"
                    },
                    {
                        "pk": 8,
                        "text": "eagle"
                    }
                ]
            }
        ]
    }

surveys_system's People

Contributors

chelovek0116 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.