text: # -*- coding: utf-8 -*-
  #
  # Copyright (c) 2013 Clione Software
  # Copyright (c) 2010-2013 Cidadania S. Coop. Galega
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  from django.contrib import admin
  from django.utils.translation import ugettext_lazy as _
  
  from guardian.admin import GuardedModelAdmin
  
  from apps.ecidadania.voting.models import Poll, Choice, Voting, ConfirmVote
  
  
  class ChoiceInline(admin.TabularInline):
          model = Choice
  
  
  class PollAdmin(GuardedModelAdmin):
          list_display = ('question', 'pub_date', 'poll_lastup', 'author',
                                       'space')
          search_fields = ('question', 'author', 'space')
  
          inlines = [ChoiceInline]
  
  
  class VotingAdmin(GuardedModelAdmin):
  
          list_display = ('title', 'start_date', 'end_date', 'author', 'space')
          search_fields = ('title', 'author', 'space')
  
  
  class VoteTokenAdmin(admin.ModelAdmin):
      """
      Rgis admin class lists all the tokens and mails and their status.
  
      .. versionadded:: 0.1.8
      """
      list_display = ('user', 'proposal', 'token')
      search_fields = ('user', 'proposal', 'token')
  
  
  admin.site.register(Poll, PollAdmin)
  admin.site.register(Voting, VotingAdmin)
  admin.site.register(ConfirmVote, VoteTokenAdmin)
  