Created
October 11, 2016 17:46
-
-
Save vitorfs/afae1190a54a6cb4ea27d06bb476bd40 to your computer and use it in GitHub Desktop.
Removing "sites" from Django's Flatpages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.flatpages.admin import FlatPageAdmin | |
from django.contrib.flatpages.models import FlatPage | |
from django.utils.translation import ugettext_lazy as _ | |
class CustomFlatPageAdmin(FlatPageAdmin): | |
fieldsets = ( | |
(None, {'fields': ('url', 'title', 'content',)}), | |
(_('Advanced options'), { | |
'classes': ('collapse',), | |
'fields': ('registration_required', 'template_name'), | |
}), | |
) | |
list_filter = ('registration_required',) | |
admin.site.unregister(FlatPage) | |
admin.site.register(FlatPage, CustomFlatPageAdmin) | |
# If you want, you may also remove the Site from django admin | |
from django.contrib.sites.models import Site | |
admin.site.unregister(Site) |
@luzdealba usually I have a generic Django app named "core" for this kind of use case. So in that case I add this core in the admin.py file inside the core app
@vitorfs oh, that's clever! Will take that idea, thanks! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello Vitor, where do you actually locate this file?