Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Bad rewrite of html pages #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Bad rewrite of html pages #24

wants to merge 2 commits into from

Conversation

BoAnd
Copy link
Contributor

@BoAnd BoAnd commented Mar 28, 2016

I have only rewrite/create the base, index, error and usermenu page. And create some create functions in views.py to handle the requests.

'products': listings,
})
output = template.render(variables)
return HttpResponse(output)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some activity, wooho :)

This way of rendering views is a bit old and not really used anymore. A rewritten index function with a modern approach (though still function based) could be something along the lines of:

from django.shortcuts import render

def index(request):
    args = {
        'head_title': 'Stregsystem',
        'products': Listing.objects.all()
    }
    return render(request, 'stregsystem/index.html', args)

You might want to consider not sending the head title with all responses, though. I'll comment below on a prettier way to handle this :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants