Skip to content

Commit

Permalink
moved ordering from model to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderGi committed Oct 26, 2023
1 parent 7e1806e commit 75b806e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 16 additions & 0 deletions glossary_resources/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
from django.contrib import admin
from .models import GlossaryResource


# Register your models here.
@admin.register(GlossaryResource)
class GlossaryAdmin(admin.ModelAdmin):
list_display = ("f_url", "usage_count", "last_updated", "glossary_name")
list_filter = ("usage_count", "last_updated")
search_fields = ("f_url", "glossary_name")
ordering = ["usage_count", "last_updated"]
readonly_fields = (
"f_url",
"usage_count",
"last_updated",
"glossary_name",
"project_id",
"location",
)
3 changes: 1 addition & 2 deletions glossary_resources/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.6 on 2023-10-19 08:43
# Generated by Django 4.2.6 on 2023-10-26 20:45

import bots.custom_fields
from django.db import migrations, models
Expand Down Expand Up @@ -37,7 +37,6 @@ class Migration(migrations.Migration):
("location", models.CharField(default="us-central1", max_length=100)),
],
options={
"ordering": ["usage_count", "last_updated"],
"indexes": [
models.Index(
fields=["usage_count", "last_updated"],
Expand Down
1 change: 0 additions & 1 deletion glossary_resources/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class GlossaryResource(models.Model):
location = models.CharField(max_length=100, default="us-central1")

class Meta:
ordering = ["usage_count", "last_updated"]
indexes = [
models.Index(
fields=[
Expand Down

0 comments on commit 75b806e

Please sign in to comment.