<commit_before>from django.shortcuts import render, redirect
from django.views.generic import View
from django.views.generic.list import ListView

from main.forms import OrderModelForm
from main.models import Order


def home(request):
    return render(request, 'main/home.html')


class OrderListView(ListView):

    model = Order

    # def get(self, request):
    #     orders = Order.objects.all()
    #     context = {}
    #     context['orders'] = order
    #     return render(request, 'main/order_list')



class OrderModelFormView(View):

    def get(self, request):
        form = OrderModelForm()
        context = {}
        context['form'] = form
        return render(request, 'main/order_form.html', context)
        # return render(request, 'main/home.html')

    def post(self, request):
        context = {}
        form = OrderModelForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('main:order_form')
        else:
            context['form'] = form
            return render(request, 'main/order_form.html', context)<commit_msg>order_list shows last modifed first. removed old comment block.<commit_after>from django.shortcuts import render, redirect
from django.views.generic import View
from django.views.generic.list import ListView

from main.forms import OrderModelForm
from main.models import Order


def home(request):
    return render(request, 'main/home.html')


class OrderListView(ListView):
    model = Order

    def get_queryset(self):
        return Order.objects.all().order_by('-modified')


class OrderModelFormView(View):

    def get(self, request):
        form = OrderModelForm()
        context = {}
        context['form'] = form
        return render(request, 'main/order_form.html', context)
        # return render(request, 'main/home.html')

    def post(self, request):
        context = {}
        form = OrderModelForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('main:order_form')
        else:
            context['form'] = form
            return render(request, 'main/order_form.html', context)
{'fraction_non_alphanumeric': 0.1101813110181311, 'fraction_numerical': 0.0, 'mean_word_length': 2.7754385964912283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2040955', 'n_tokens_mistral': 603, 'n_tokens_neox': 581, 'n_words': 152}