Exemple #1
0
    class Admin(EntityAdmin):
        verbose_name = 'Faza Activitate'
        verbose_name_plural = 'Faze Activitati'
        list_display = ['nume', 'descriere', 'data_inceput', 'data_sfarsit']

        form_display = TabForm([('Importante', Form(['nume', 'descriere', 'data_inceput', 'data_sfarsit'])),
                                ('Taskuri', Form(['task']))]
                               )
Exemple #2
0
    class Admin(EntityAdmin):
        # the list_display attribute specifies which entity attributes should
        # be visible in the table view
        list_display = ['cover', 'title', 'releasedate', 'rating',]
        lines_per_row = 5
        # define filters to be available in the table view
        list_filter = ['genre', list_filter.ComboBoxFilter('director.full_name')]
        # if the search function needs to look in related object attributes,
        # those should be specified within list_search
        list_search = ['director.full_name']
        # begin list_actions
        #
        # the action buttons that should be available in the list view
        #
        list_actions = [ChangeRatingAction()]
        # end list_actions
        drop_action = DropAction()
        # the form_display attribute specifies which entity attributes should be
        # visible in the form view
        form_display = TabForm([
          ('Movie', Form([
            HBoxForm([WidgetOnlyForm('cover'), ['title', 'rating', Stretch()]]),
            'short_description',
            'releasedate',
            'director',
            'script',
            'genre',
            'description',], columns = 2)),
          ('Cast', WidgetOnlyForm('cast')),
          ('Visitors', WidgetOnlyForm('visitors_chart')),
          ('Tags', WidgetOnlyForm('tags'))
        ])

        # begin form_actions
        #
        # create a list of actions available for the user on the form view
        #
        form_actions = [BurnToDisk()]
        # end form_actions
        #
        # additional attributes for a field can be specified in the
        # field_attributes dictionary
        #
        field_attributes = dict(cast=dict(create_inline=True),
                                genre=dict(choices=genre_choices, editable=lambda o:bool(o.title and len(o.title))),
                                releasedate=dict(background_color=lambda o:ColorScheme.orange_1 if o.releasedate and o.releasedate < datetime.date(1920,1,1) else None),
                                visitors_chart=dict(delegate=delegates.ChartDelegate),
                                rating=dict(tooltip='''<table>
                                                          <tr><td>1 star</td><td>Not that good</td></tr>
                                                          <tr><td>2 stars</td><td>Almost good</td></tr>
                                                          <tr><td>3 stars</td><td>Good</td></tr>
                                                          <tr><td>4 stars</td><td>Very good</td></tr>
                                                          <tr><td>5 stars</td><td>Awesome !</td></tr>
                                                       </table>'''),
                                smiley=dict(delegate=delegates.SmileyDelegate),
                                script=dict(remove_original=True))
 class Admin(EntityAdmin):
     verbose_name = 'Activitate'
     verbose_name_plural = 'Activitati'
     list_display = ['nume', 'aprobata']
     form_display = TabForm([('Importante', Form(['nume', 'coordonator'])),
                             ('Participanti', Form(['membrii'])),
                             ('Resurse', Form(['res_fin',
                                               'res_logistice'])),
                             ('Faze', Form(['faze']))])
     field_attributes = dict(ResurseUmane.Admin.field_attributes)
     form_actions = [RapoarteActivitati()]
 class Admin( Party.Admin ):
     verbose_name = _( 'Organization' )
     verbose_name_plural = _( 'Organizations' )
     list_display = ['name', 'tax_id', 'contact_mechanisms_email', 'contact_mechanisms_phone']
     form_display = TabForm( [( _('Basic'), Form( ['name', 'tax_id', 'addresses', 'contact_mechanisms'] ) ),
                             ( _('Employment'), Form( ['employees'] ) ),
                             ( _('Customers'), Form( ['customers'] ) ),
                             ( _('Suppliers'), Form( ['suppliers'] ) ),
                             ( _('Corporate'), Form( ['directors', 'shareholders', 'shares'] ) ),
                             ( _('Branding'), Form( ['logo'] ) ),
                             ( _('Status'), Form( ['status'] ) ),
                             ] )
Exemple #5
0
class PersonAdmin(Party.Admin):
    verbose_name = _('Person')
    verbose_name_plural = _('Persons')
    list_display = ['first_name', 'last_name', 'email', 'phone']
    form_display = TabForm([
        (_('Basic'),
         Form([
             HBoxForm([
                 Form([
                     WidgetOnlyForm('note'),
                     'first_name',
                     'last_name',
                     'sex',
                     'email',
                     'phone',
                     'fax',
                     'street1',
                     'street2',
                     'city',
                 ]),
                 [
                     WidgetOnlyForm('picture'),
                 ],
             ]),
             'comment',
         ],
              scrollbars=False)),
        (_('Official'),
         Form([
             'birthdate',
             'social_security_number',
             'passport_number',
             'passport_expiry_date',
             'addresses',
             'contact_mechanisms',
         ],
              scrollbars=False)),
        (_('Work'),
         Form(['employers', 'directed_organizations', 'shares'],
              scrollbars=False)),
        (_('Category'), Form([
            'categories',
        ])),
    ])
    field_attributes = dict(Party.Admin.field_attributes)
    field_attributes['note'] = {'delegate': delegates.NoteDelegate}

    def get_query(self):
        query = super(PersonAdmin, self).get_query()
        query = query.options(orm.joinedload('contact_mechanisms'))
        return query
 class Admin( Party.Admin ):
     verbose_name = _( 'Person' )
     verbose_name_plural = _( 'Persons' )
     list_display = ['first_name', 'last_name', 'contact_mechanisms_email', 'contact_mechanisms_phone']
     form_display = TabForm( [( _('Basic'), Form( [HBoxForm( [Form( [WidgetOnlyForm('note'), 'first_name', 'last_name', 'sex'] ),
                                                       Form( ['picture', ] ),
                                                      ] ),
                                                      'contact_mechanisms', 'comment', ], scrollbars = False ) ),
                             ( _('Official'), Form( ['birthdate', 'social_security_number', 'passport_number',
                                                     'passport_expiry_date', 'addresses', ], scrollbars = False ) ),
                             ( _('Work'), Form( ['employers', 'directed_organizations', 'shares'], scrollbars = False ) ),
                             ( _('Status'), Form( ['status'] ) ),
                             ] )
     field_attributes = dict( Party.Admin.field_attributes )
     field_attributes['note'] = {'delegate':delegates.NoteDelegate}
Exemple #7
0
class OrganizationAdmin(Party.Admin):
    verbose_name = _('Organization')
    verbose_name_plural = _('Organizations')
    list_display = ['name', 'tax_id', 'email', 'phone', 'fax']
    form_display = TabForm([
        (_('Basic'),
         Form([
             WidgetOnlyForm('note'), 'name', 'email', 'phone', 'fax', 'tax_id',
             'street1', 'street2', 'city', 'addresses', 'contact_mechanisms'
         ])),
        (_('Branding'), Form(['logo'])),
    ])
    field_attributes = dict(Party.Admin.field_attributes)

    def get_query(self):
        query = super(OrganizationAdmin, self).get_query()
        query = query.options(orm.joinedload('contact_mechanisms'))
        return query
Exemple #8
0
class PersonAdmin(Party.Admin):
    verbose_name = _('Person')
    verbose_name_plural = _('Persons')
    list_display = ['first_name', 'last_name', 'email', 'phone']
    form_display = TabForm([
        (_('Basic'),
         Form([
             HBoxForm([
                 Form([
                     WidgetOnlyForm('note'),
                     'first_name',
                     'last_name',
                     'sex',
                     'email',
                     'phone',
                     'fax',
                     'street1',
                     'street2',
                     'city',
                 ]),
                 [WidgetOnlyForm('picture'),
                  Stretch()],
             ]),
             'comment',
         ],
              scrollbars=False)),
        (_('Official'),
         Form([
             'birthdate',
             'social_security_number',
             'passport_number',
             'passport_expiry_date',
             'addresses',
             'contact_mechanisms',
         ],
              scrollbars=False)),
    ])

    def get_query(self):
        query = super(PersonAdmin, self).get_query()
        query = query.options(orm.joinedload('contact_mechanisms'))
        return query
Exemple #9
0
class OrganizationAdmin(Party.Admin):
    verbose_name = _('Organization')
    verbose_name_plural = _('Organizations')
    list_display = ['name', 'tax_id', 'email', 'phone', 'fax']
    form_display = TabForm([
        (_('Basic'),
         Form([
             'name', 'email', 'phone', 'fax', 'tax_id', 'street1', 'street2',
             'city', 'addresses', 'contact_mechanisms'
         ])),
        (_('Employment'), Form(['employees'])),
        (_('Customers'), Form(['customers'])),
        (_('Suppliers'), Form(['suppliers'])),
        (_('Corporate'), Form(['directors', 'shareholders', 'shares'])),
        (_('Branding'), Form(['logo'])),
        (_('Category and Status'), Form(['categories', 'status'])),
    ])
    field_attributes = dict(Party.Admin.field_attributes)

    def get_query(self):
        query = super(OrganizationAdmin, self).get_query()
        query = query.options(orm.joinedload('contact_mechanisms'))
        return query
Exemple #10
0
 class Admin(EntityAdmin):
     verbose_name = 'Beneficiaria'
     delete_mode = 'on_confirm'
     list_columns_frozen = 1
     lines_per_row = 1  # lo especifico por la foto
     delete_mode = 'on_confirm'
     list_display = [
         'nombre',
         'apellido',
         'grupo',
         'fecha_alta',
         '_activa',
         'fecha_baja',
         'comentarios',
         'dni',
         'fecha_nac',
         'domicilio',
         'estado_civil',
         'telefono',
         'email',
         'barrio',
     ]
     form_display = TabForm([
         ('Beneficiaria',
          Form([
              HBoxForm([[
                  'nombre',
                  'apellido',
                  'barrio',
                  'grupo',
                  '_activa',
                  'fecha_alta',
                  'fecha_baja',
                  'comentarios',
                  'dni',
                  'fecha_nac',
              ],
                        [
                            WidgetOnlyForm('foto'), 'estado_civil',
                            'domicilio', 'telefono', 'email',
                            'creditos_activos'
                        ]])
          ])),
         (u'Créditos', WidgetOnlyForm('creditos')),
     ])
     list_filter = [
         GroupBoxFilter('activa', default=True),
         ComboBoxFilter('barrio.nombre'),
     ]
     search_all_fields = False
     list_search = [
         'id',
         'nombre_completo',
         'comentarios',
         'dni',
         'grupo',
         'barrio.nombre',
     ]
     expanded_list_search = [
         'nombre',
         'apellido',
         'grupo',
         'fecha_alta',
         'fecha_baja',
         'comentarios',
         'dni',
         'fecha_nac',
         'barrio.nombre',
     ]
     field_attributes = dict(
         fecha_alta=dict(name='Fecha Alta'),
         _activa=dict(
             name='Activa',
             delegate=BoolDelegate,
             # to_string = lambda x:{True:'Si', False:'No'}[x], # TODO no lo toma
             editable=True,
             tooltip=
             u'No se puede dar de baja una beneficiaria si tiene créditos activos.'
         ),
         fecha_baja=dict(
             name='Fecha Baja',
             tooltip=
             u'Al desactivar la beneficiaria, este campo toma la última fecha de pago'
         ),
         dni=dict(name='DNI'),
         fecha_nac=dict(name='Fecha Nac.'),
         estado_civil=dict(name='Estado Civil'),
         telefono=dict(name=u'Teléfono'),
         email=dict(address_type='email'),
         creditos=dict(admin=CreditoAdminEmbedded),
         creditos_activos=dict(name=u'Créditos activos', editable=False),
     )
     form_size = (850, 400)
Exemple #11
0
                   #create_inline = True,  # no funciona como se espera
                   ),
        # TODO por el momento el name es estatico, no se puede cambiar en funcion de otros valores
        # monto_cheque = dict(name = lambda o: 'Monto Presupuesto' if o.rubro.actividad.id == ID_ACTIVIDAD_CONSTRUCCION else 'Monto Cheque'),
    )

    form_display = TabForm([
        (u'Crédito',
         Form([
             HBoxForm([[
                 'beneficiaria', 'rubro', 'cartera', 'nro_credito', 'cuotas'
             ]]),
             HBoxForm([[
                 '_fecha_entrega', 'fecha_cobro', '_prestamo',
                 '_saldo_anterior', 'monto_cheque'
             ],
                       [
                           '_tasa_interes', 'deuda_total',
                           'fecha_finalizacion', 'comentarios', 'gastos_arq'
                       ]])
         ])),
        (u'Pagos',
         Form([WidgetOnlyForm('pagos'), 'deuda_total', 'total_pagos',
               'saldo'])),
    ])

    form_actions = [
        reports.ContratoMutuo(),
        reports.PlanillaPagos(),
    ]