Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Benjamin Kampmann
    @gnunicorn
    @gabericharde :thumbsup:
    @MisterRios , @samurang87 : if you know the github handles of any other organiser, feel free to add them!
    Chiara Mezzavilla
    @samurang87
    (y)
    uhm
    ok!
    Kristine
    @krstnschwpwr
    Hi! Anyone familiar with REST and Django ?
    Benjamin Kampmann
    @gnunicorn
    somewhat, yes.
    what's the problem?
    Kristine
    @krstnschwpwr
    I am using REST for displaying values from my db as json where the url is "http://127.0.0.1:8000/api/measurements/latest?format=json“ Now I am trying to define a new format called „prtg“ so the whole url should look like this "http://127.0.0.1:8000/api/measurements/latest?format=prtg“ and return json but having a different structure..I would like to know how to do this. Any ideas?
    Benjamin Kampmann
    @gnunicorn
    @krstnschwpwr are you using any additional frameworks? like django-rust?
    Kristine
    @krstnschwpwr
    no its just simple django 1.10
    Benjamin Kampmann
    @gnunicorn
    if not and you are just in an usual django handler/view, you can just check for the parameter (like if request.GET.get("format") == "prtg") and render it differently
    Kristine
    @krstnschwpwr
    yeah i have something like this already def prtg_json(request):
    if 'format' in request.GET and request.GET['format'] == 'prtg':
    queryset = Speed.objects.latest()
    serializer = SpeedPrtgSerializer(queryset, many=False)
    return Response(serializer.data) …trying to use a different serializer for this
    Benjamin Kampmann
    @gnunicorn
    (you might want to use a pastebin or gist to ensure formatting stays in tact)
    and that doesn't work?
    (because working with a serialiser was the other thing I wanted to recommend)
    @krstnschwpwr I think in the last line it might have to be return Response(serializer.get_value())
    but I am just quoting from the docs here, not used serialisers myself.
    Biswarup Banerjee
    @techguybiswa
    Hi.
    I am new here and probably the first non German guy
    I am front end web developer but have recently started with python to learn Django
    So is codecademy a good start?
    I already know HTML CSS JS C/C++
    And bootstrap
    Biswarup Banerjee
    @techguybiswa
    @MisterRios I guess you can help me out with the initial phase in Python parking
    *learning