<commit_before>from django import forms
from django.contrib import admin

class OrderableAdmin(admin.ModelAdmin):
    exclude = ('order',)
    order_field = 'order'
    
    change_list_template = 'orderable/change_list.html'
    
    def __init__(self, *args, **kwargs):
        super(OrderableAdmin, self).__init__(*args, **kwargs)
        
        if self.order_field not in self.list_display:
            self.list_display = list(self.list_display) + [self.order_field]
        
        if self.order_field not in self.list_editable:
            self.list_editable = list(self.list_editable) + [self.order_field]

class OrderableInline(object):
    def _media(self):
        from django.core.urlresolvers import reverse
        return forms.Media(js=(
            'http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js',
            'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js',
            reverse('orderable:javascript'),
        ))
    media = property(_media)<commit_msg>Added ordering option to OrderableAdmin to force ordering.<commit_after>from django import forms
from django.contrib import admin

class OrderableAdmin(admin.ModelAdmin):
    exclude = ('order',)
    order_field = 'order'
    ordering = ('order',)
    
    change_list_template = 'orderable/change_list.html'
    
    def __init__(self, *args, **kwargs):
        super(OrderableAdmin, self).__init__(*args, **kwargs)
        
        if self.order_field not in self.list_display:
            self.list_display = list(self.list_display) + [self.order_field]
        
        if self.order_field not in self.list_editable:
            self.list_editable = list(self.list_editable) + [self.order_field]

class OrderableInline(object):
    def _media(self):
        from django.core.urlresolvers import reverse
        return forms.Media(js=(
            'http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js',
            'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js',
            reverse('orderable:javascript'),
        ))
    media = property(_media)
{'fraction_non_alphanumeric': 0.11946692051404094, 'fraction_numerical': 0.005711565920990005, 'mean_word_length': 2.7942238267148016, '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': '4855861', 'n_tokens_mistral': 646, 'n_tokens_neox': 638, 'n_words': 116}