Skip to content

Instantly share code, notes, and snippets.

@prrraveen
Created August 10, 2015 18:59
Show Gist options
  • Save prrraveen/9fc23f0d2ab5538828d4 to your computer and use it in GitHub Desktop.
Save prrraveen/9fc23f0d2ab5538828d4 to your computer and use it in GitHub Desktop.
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_GET, require_POST
import pdb
import json
def edit(request):
brand ={
'colors' :[
{ 'id' : 1 , 'value' : 'RED' },
{ 'id' : 2 , 'value' : 'WHITE' },
{ 'id' : 3 , 'value' : 'BLACK' },
{ 'id' : 4 , 'value' : 'YELLOR' }
],
'flyrobe_sizes': [
{'id' : 36 , 'value' : 'foo Size'},
{'id' : 35 , 'value' : 'Bar size'},
{'id' : 7 , 'value' : 'falana size'},
{'id' : 1 , 'value' : 'dikda size'},
],
}
opt = {
'brand' : brand
}
item = {
'id' : 2,
'name': 'FOO',
'colors': [3, 4],
'flyrobe_sizes': ['36', "35"]
}
result = {
'opt': opt,
'item': item
}
return HttpResponse(json.dumps(result), content_type='application/json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment