class Client(models.Model):
full_name = models.CharField('Full name', max_length=45)
class Document(models.Model):
description = models.CharField('Description', max_length=45)
client = models.ForeignKey('Client')
class Ticket(models.Model):
description = models.CharField('Description', max_length=255)
document = models.ForeignKey('Document')items = [1, 2, 3, 4]
def get_item_as_method():
return items.__getitem__(1)
def get_item_as_operator():
return items[1]LOAD_GLOBAL 0 (items)
LOAD_ATTR 1 (__getitem__)
LOAD_CONST 1 (1)
CALL_FUNCTION 1 (1 positional, 0 keyword pair)
RETURN_VALUELOAD_GLOBAL 0 (items)
LOAD_CONST 1 (1)
BINARY_SUBSCR
RETURN_VALUEhttps://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN{
"data": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg",
"bio": "This is my bio",
"website": "http://snoopdogg.com",
"counts": {
"media": 1320,
"follows": 420,
"followed_by": 3410
}
} is_voted = user in question.voted_users.all()is_voted = question.voted_users.filter(pk=user.pk).exists()voted = request.POST['choice']
voted_choice = get_object_or_404(Choice, pk=voted)curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bashsudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvmpyenv install 3.4.2 # установить версию 3.4.2pyenv virtualenv 3.4.2 <name_of_venv> REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
)
}class ItIsView(...):
renderer_classes = [renderers.JSONRenderer]