Login

Searching and Deleting Cache Entries in Admin tool

Author:
shootclub
Posted:
July 16, 2011
Language:
Python
Version:
Not specified
Score:
1 (after 1 ratings)

A simple model and admin entry for managing Cache table through the Django admin interface.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# models.py

class CacheTable(models.Model):
    cache_key = models.CharField(max_length=255, primary_key=True)
    value = models.TextField()
    expires = models.DateTimeField(null=True, blank=True, default=None)

    class Meta:
        db_table = '<cache-table-name>'


# admin.py


class CacheTableAdmin(admin.ModelAdmin):
    list_display = ('cache_key', 'expires')
    search_fields = ('cache_key', )

admin.site.register(CacheTable, CacheTableAdmin)

More like this

  1. New Snippet! by Antoliny0919 4 days, 22 hours ago
  2. Add Toggle Switch Widget to Django Forms by OgliariNatan 2 months, 3 weeks ago
  3. get_object_or_none by azwdevops 6 months, 2 weeks ago
  4. Mask sensitive data from logger by agusmakmun 8 months, 1 week ago
  5. Template tag - list punctuation for a list of items by shapiromatron 1 year, 10 months ago

Comments

Please login first before commenting.