Giter Site home page Giter Site logo

ems's People

Contributors

aarav-tech avatar hardikptelzymr avatar hiamandeep avatar hnmpatel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ems's Issues

elastic search

Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django/core/management/init.py", line 347, in execute
django.setup()
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/snj/.virtualenvs/ems/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django_elasticsearch_dsl/init.py", line 3, in
from .documents import Document # noqa
File "/home/snj/.virtualenvs/ems/lib/python3.6/site-packages/django_elasticsearch_dsl/documents.py", line 7, in
from elasticsearch_dsl import Document as DSLDocument
ImportError: cannot import name 'Document'

Model objects handling

Hi sir.... Can I display the questions as per user.... Am trying to ....because all questions are referring for all user can it be restricted by manager id

Poor README.md

Your readme is too short which makes it difficult to understand your code.

gunicorn unrecognized arguments

Hi Hardik,
I am stuck at starting the gunicorn service using shell script you provided.
I am getting below error-
gunicorn: error: unrecognized arguments: ubuntu /home/ubuntu/ankit/ems/run/gunicorn.sock

Here are the script details-

#!/bin/bash

NAME="ems"
DJANGODIR=/home/ubuntu/ankit/ems-
SOCKFILE=/home/ubuntu/ankit/ems-/run/gunicorn.sock
USER=ubuntu
GROUP=ubuntu
NUM_WORKERS=3
DJANGO_SETTINGS_MODULE=ems.settings
DJANGO_WSGI_MODULE=ems.wsgi

echo "Starting $NAME as whoami"

Activate the virtual environment

cd $DJANGODIR
source ../venv/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH

Create the run directory if it doesn't exist

RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

Start your Django Unicorn

Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)

exec /home/ubuntu/ankit/venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application
--name $NAME
--workers $NUM_WORKERS
--user = $USER --group=$GROUP
--bind = $SOCKFILE
--log-level=debug
--log-file=-

Nested manytomany relationship with serializer

Hi,
can you suggest how to handle manytomany relationship

I have the following models
#this model can be associated with more than 1 post
class Category(models.Model):
title = models.CharField(max_length=255,unique=True, blank=False, null=False)

#this model can be associated with more than 1 category
class Post(models.Model):
# post title
title = models.CharField(max_length=255, null=False)
content = models.TextField(null = False, max_length=12000)
slug = models.CharField(max_length=255, null=False, unique=True)
categories = models.ManyToManyField(Category, related_name='categories')

Can you please advise how to write a serializer that posts new data.

class PostCategorySerializer(serializers.ModelSerializer):

class Meta:
    model = Category
    read_only_fields = ('id',)
    exclude = ('title','created_by')

class PostSerializer(serializers.ModelSerializer):
created_by_id = serializers.PrimaryKeyRelatedField(
queryset=User.objects.all(), source='created_by', write_only=True, required=False)
categories = PostCategorySerializer(many=True)

class Meta:
    model = Post
    fields = ('title', 'content', 'slug', 'categories', 'created_by_id')

def create(self, validated_data):
    #before saving the post remove the field categories to avoid errors
    categories = validated_data.pop('categories')
    post = Post.objects.create(**validated_data)
    for cat in categories:
        Category.objects.create(**cat, categories=post)
    return post

When I make the api request the post is created in the database but the categories are not associated

curl -H "Authorization: Bearer HKAEKzMg278hjsMVYYPlCdq6OqFA21" -X POST -H 'Content-Type: application/json' -d '{"title":"My first post","content":"My first post", "slug":"my-first-post", "short_description":"my first post....", "categories":[{"id":2, "title":"Python"}], "created_by":"2", "created_by_id":"2"}' http://localhost:8000/api/v1/posts/

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.