Skip to content

Instantly share code, notes, and snippets.

View maryokhin's full-sized avatar

Tymur Maryokhin maryokhin

View GitHub Profile
class PostSerializer(ModelSerializer):
"""
General post serializer.
"""
url = ReverseField(view_name='post-instance')
channel = ChannelSerializer(read_only=True)
user = UserInstanceSerializer(read_only=True)
latest_comments = serializers.SerializerMethodField('get_latest_comments')
comments_url = ReverseField(view_name='post-comment-list')
channel_id = serializers.PrimaryKeyRelatedField(source='channel', write_only=True)
@maryokhin
maryokhin / pytest DB connection error
Created July 13, 2014 21:11
Using the same settings as unittest, but pytest can't connect
/Users/maryokhin/.virtualenvs/backend/bin/python /Applications/PyCharm.app/helpers/pycharm/pytestrunner.py -p pytest_teamcity /Users/maryokhin/Workspace/backend/api/tests/test_comment2.py
Testing started at 23:08 ...
============================= test session starts ==============================
platform darwin -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2
plugins: django
collected 1 items
../../../Users/maryokhin/Workspace/backend/api/tests/test_comment2.py E
def setup_module():
> channel = Channel.objects.create(name='test')
graph [
{{#each nodes ~}}
node [
id {{id}}
isGroup {{isGroup}}
label "
<html><h2 align=&quot;center&quot;>{{label}}</h2></html>"
]
{{/each ~}}
{{#each edges ~}}