Exemple #1
0
crudlfap.Router(
    User,
    views=[
        crudlfap.DeleteObjectsView,
        crudlfap.DeleteView,
        crudlfap.UpdateView.clone(
            fields=[
                'username',
                'email',
                'first_name',
                'last_name',
                'groups',
                'is_superuser',
                'is_staff',
                'is_active',
            ]
        ),
        crudlfap.CreateView.clone(
            fields=[
                'username',
                'email',
                'groups',
                'is_staff',
                'is_superuser'
            ],
        ),
        views.PasswordView,
        views.BecomeUser,
        crudlfap.DetailView.clone(exclude=['password']),
        crudlfap.ListView.clone(
            search_fields=[
                'username',
                'email',
                'first_name',
                'last_name'
            ],
            table_fields=[
                'username',
                'email',
                'first_name',
                'last_name',
                'is_staff',
                'is_superuser'
            ],
            filter_fields=[
                'groups',
                'is_superuser',
                'is_staff'
            ],
        ),
    ],
    urlfield='username',
    material_icon='person',
).register()
Exemple #2
0
from crudlfap import shortcuts as crudlfap

from .models import Artist

crudlfap.Router(
    Artist,
    fields='__all__',
    icon='record_voice_over',
).register()
Exemple #3
0
from crudlfap import shortcuts as crudlfap

from .models import Site

crudlfap.Router(model=Site, icon='language').register()
Exemple #4
0
        for date, row in dates.items():
            columns[0].append(date.strftime('%Y-%m-%d'))
            for i, et in enumerate(templates):
                columns[i + 1].append(row[i])

        return json.dumps(
            dict(bindto='#chart',
                 data=dict(
                     x='x',
                     columns=columns,
                 ),
                 axis=dict(
                     x=dict(type='timeseries', tick=dict(format='%d/%m/%Y', )),
                     y=dict(
                         min=0,
                         padding=dict(bottom=0),
                     ),
                 ),
                 point=dict(show=len(dates.keys()) < 32, )))


'''
crudlfap.Router(
    model=MRSRequestLogEntry,
    material_icon='insert_chart',
    views=[
        MRSRequestLogEntryListView,
    ],
).register()
'''
Exemple #5
0
            if datemin:
                filtr = filtr & models.Q(
                    mrsrequestlogentry__datetime__gte=datetime_min(datemin))

            if datemax:
                filtr = filtr & models.Q(
                    mrsrequestlogentry__datetime__lte=datetime_max(datemax))

            if user:
                filtr = filtr & models.Q(mrsrequestlogentry__user=user)

        if self.request.user.profile == 'upn':
            filtr = filtr & models.Q(
                mrsrequestlogentry__user=self.request.user)

        self.object_list = self.object_list.annotate(new_counter=models.Count(
            'mrsrequestlogentry', distinct=True, filter=filtr), )

        return self.object_list


crudlfap.Router(EmailTemplate,
                allowed_groups=['Admin'],
                material_icon='mail',
                views=[
                    EmailTemplateListView,
                    crudlfap.CreateView,
                    crudlfap.UpdateView,
                ]).register()
Exemple #6
0
            '?active=2',
        ])


class CaisseDetailView(crudlfap.DetailView):
    def get_contact_subjects_counts(self):
        choices = dict(self.object.contact_set.model.SUBJECT_CHOICES)
        qs = self.object.contact_set.values('subject').annotate(
            total=models.Count('subject')).order_by('total')
        return {choices[res['subject']]: res['total'] for res in qs}


crudlfap.Router(Caisse,
                allowed_groups=['Admin'],
                material_icon='domain',
                views=[
                    crudlfap.CreateView.clone(form_class=CaisseForm),
                    crudlfap.DeleteView,
                    crudlfap.UpdateView.clone(form_class=CaisseForm),
                    CaisseDetailView,
                    CaisseListView,
                ]).register()

crudlfap.Router(Email,
                allowed_groups=['Admin'],
                material_icon='contact_mail',
                views=[
                    crudlfap.ListView.clone(table_sequence=('email',
                                                            'caisse'), ),
                ]).register()
Exemple #7
0
from crudlfap import shortcuts as crudlfap
from django_filters import filters

from .models import Call, Caller, Cron

crudlfap.Router(
    Call,
    material_icon='assistant',
    views=[
        crudlfap.ListView.clone(table_fields=[
            'caller',
            'created',
            'started',
            'ended',
            'status',
        ], ),
        crudlfap.DetailView,
    ],
).register()

crudlfap.Router(
    Caller,
    material_icon='assignment_ind',
    views=[
        crudlfap.ListView.clone(
            filterset_extra_class_attributes=dict(status=filters.ChoiceFilter(
                choices=Caller.STATUS_CHOICES)),
            table_fields=[
                'id',
                'callback',
                'spooled',
Exemple #8
0
from crudlfap import shortcuts as crudlfap

from .models import Artist


crudlfap.Router(
    Artist,
    fields='__all__',
).register()
Exemple #9
0
from crudlfap import shortcuts as crudlfap

from .models import Institution

crudlfap.Router(Institution,
                allowed_groups=['Admin'],
                material_icon='local_hospital',
                namespace='institutionrouter',
                views=[
                    crudlfap.ListView(table_sequence=('finess', 'origin')),
                    crudlfap.CreateView,
                    crudlfap.UpdateView,
                    crudlfap.DeleteView,
                ]).register()