Skip to content
Snippets Groups Projects
Select Git revision
  • 5fd219af92171df9884aa565ca0f9d264c7b7922
  • develop default protected
  • master protected
  • feature/POL1-813-error-report-sensu-check
  • 0.22
  • 0.21
  • 0.20
  • 0.19
  • 0.18
  • 0.17
  • 0.16
  • 0.15
  • 0.14
  • 0.13
  • 0.12
  • 0.11
  • 0.10
  • 0.9
  • 0.8
  • 0.7
  • 0.6
  • 0.5
  • 0.4
  • 0.3
24 results

interfaces.py

Blame
  • admin.py 1.74 KiB
    # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
    # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
    
    # Copyright (C) 2010-2014 GRNET S.A.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    #
    
    from django.contrib import admin
    from django import forms
    from django.core.urlresolvers import reverse
    from django.contrib.flatpages.admin import FlatPageAdmin
    from django.contrib.flatpages.models import FlatPage
    
    from tinymce.widgets import TinyMCE
    from accounts.models import UserProfile
    
    
    class UserPrAdmin(admin.ModelAdmin):
        search_fields = ['user__username', 'peer__peer_name']
        list_display = ('user', 'peer')
    
    admin.site.register(UserProfile, UserPrAdmin)
    
    
    
    class TinyMCEFlatPageAdmin(FlatPageAdmin):
        def formfield_for_dbfield(self, db_field, **kwargs):
            if db_field.name == 'content':
                return forms.CharField(widget=TinyMCE(
                    attrs={'cols': 80, 'rows': 30},
                    mce_attrs={'external_link_list_url': reverse('tinymce.views.flatpages_link_list')},
                ))
            return super(TinyMCEFlatPageAdmin, self).formfield_for_dbfield(db_field, **kwargs)
    
    admin.site.unregister(FlatPage)
    admin.site.register(FlatPage, TinyMCEFlatPageAdmin)