Skip to content
Snippets Groups Projects
Select Git revision
  • a05b85e2930e6e7242c8ab1683b0294aaf526a35
  • develop default
  • master protected
  • feature/frontend-tests
  • 0.107
  • 0.106
  • 0.105
  • 0.104
  • 0.103
  • 0.102
  • 0.101
  • 0.100
  • 0.99
  • 0.98
  • 0.97
  • 0.96
  • 0.95
  • 0.94
  • 0.93
  • 0.92
  • 0.91
  • 0.90
  • 0.89
  • 0.88
24 results

SurveyContainerComponent.tsx

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)