Example #1
0
def notification_list(request, username, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered notifications.
    """
    user = get_object_or_404(User, username=username)

    if request.method == 'POST':
        form = SubscriptionsForm(request.POST, user=user)
        if form.is_valid():
            form.save()
            form = SubscriptionsForm(user=user)
            messages.success(request, _("The user was updated successfully."))
    else:
        if Signature.objects.count() > 0:
            form = SubscriptionsForm(user=user)
        else:
            form = None

    return filtered_list_detail(request,
                                Notification.objects.filter(user=user),
                                fields=['title', 'created', 'read'],
                                paginate_by=paginate_by,
                                page=page,
                                extra_context={
                                    'form': form,
                                    'object': user,
                                },
                                **kwargs)
Example #2
0
def tag_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all tags.
    """
    return filtered_list_detail(request,
                                Tag.objects.all(),
                                fields=['title'],
                                paginate_by=paginate_by,
                                page=page,
                                **kwargs)
Example #3
0
def category_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all categories.
    """
    return filtered_list_detail(request,
                                Category.objects.filter(parent=None),
                                fields=['title', 'parent'],
                                paginate_by=paginate_by,
                                page=page,
                                **kwargs)
Example #4
0
def project_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all published projects.
    """
    return filtered_list_detail(
        request,
        Project,
        fields=['code', 'title', 'author', 'manager', 'created', 'status'],
        paginate_by=paginate_by,
        page=page,
        **kwargs)
Example #5
0
def salesinvoice_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a sales invoice list.
    """
    return filtered_list_detail(request,
                                Document.objects.get_for_content(SalesInvoice),
                                fields=['code', 'author', 'created', 'owner'],
                                page=page,
                                paginate_by=paginate_by,
                                template_name='sales/salesinvoice_list.html',
                                **kwargs)
Example #6
0
def warehouse_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a warehouse list.
    """
    return filtered_list_detail(request,
                                Warehouse,
                                fields=['name', 'owner', 'address'],
                                page=page,
                                paginate_by=paginate_by,
                                template_name='stock/warehouse_list.html',
                                **kwargs)
Example #7
0
def project_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all published projects.
    """
    return filtered_list_detail(
        request,
        Project,
        fields=['code', 'title', 'author', 'manager', 'created', 'status'],
        paginate_by=paginate_by,
        page=page,
        **kwargs)
Example #8
0
def letter_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a letter list.
    """
    return filtered_list_detail(request,
                                Document.objects.get_for_content(Letter),
                                fields=['code', 'author', 'created', 'owner'],
                                page=page,
                                paginate_by=paginate_by,
                                template_name='partners/letter_list.html',
                                **kwargs)
Example #9
0
def poll_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all polls.
    """
    return filtered_list_detail(
        request,
        Poll,
        fields=['title', 'description', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs)
Example #10
0
def faq_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all FAQs.
    """
    return filtered_list_detail(
        request,
        Faq,
        fields=['title', 'question', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs)
Example #11
0
def page_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all wiki pages.
    """
    return filtered_list_detail(
        request,
        WikiPage,
        fields=['slug', 'language', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs)
Example #12
0
def poll_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all polls.
    """
    return filtered_list_detail(
        request,
        Poll,
        fields=['title', 'description', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs
    )   
Example #13
0
def faq_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all FAQs.
    """
    return filtered_list_detail(
        request,
        Faq,
        fields=['title', 'question', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs
    )
Example #14
0
def expensevoucher_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered expensevouchers.
    """
    return filtered_list_detail(
        request,
        Document.objects.get_for_content(ExpenseVoucher),
        fields=['code', 'author', 'created', 'owner', 'status'],
        paginate_by=paginate_by,
        page=page,
        template_name='hr/expensevoucher_list.html',
        **kwargs)
Example #15
0
def tag_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all tags.
    """
    return filtered_list_detail(
        request,
        Tag.objects.all(),
        fields=['title'],
        paginate_by=paginate_by,
        page=page,
        **kwargs
    )
Example #16
0
def category_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all categories.
    """
    return filtered_list_detail(
        request,
        Category.objects.filter(parent=None),
        fields=['title', 'parent'],
        paginate_by=paginate_by,
        page=page,
        **kwargs
    )
Example #17
0
def employee_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered employees.
    """
    return filtered_list_detail(
        request,
        Employee,
        paginate_by=paginate_by,
        page=page,
        template_name='hr/employee_list.html',
        **kwargs
    )
Example #18
0
def page_list(request, page=0, paginate_by=5, **kwargs):
    """Displays the list of all wiki pages.
    """
    return filtered_list_detail(
        request,
        WikiPage,
        fields=['slug', 'language', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        **kwargs
    )
Example #19
0
def task_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered tasks.
    """
    return filtered_list_detail(
        request,
        Task.objects.planned(user=request.user),
        paginate_by=paginate_by,
        page=page,
        fields=['title', 'start', 'end', 'created', 'closed'],
        **kwargs
    )
Example #20
0
def contact_jobs(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the contact's jobs.
    """
    contact = get_object_or_404(Contact, pk=id)

    return filtered_list_detail(request,
                                contact.job_set.all(),
                                exclude=['id', 'contact'],
                                paginate_by=paginate_by,
                                page=page,
                                extra_context={'object': contact},
                                template_name='partners/contact_jobs.html')
Example #21
0
def contact_list(request, page=0, paginate_by=10, **kwargs):
    """Show all registered contacts.
    """
    return filtered_list_detail(request,
                                Contact,
                                fields=[
                                    'id', 'firstname', 'lastname', 'language',
                                    'timezone', 'email', 'main_phone_number'
                                ],
                                paginate_by=paginate_by,
                                page=page,
                                **kwargs)
Example #22
0
def warehouse_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a warehouse list.
    """
    return filtered_list_detail(
        request,
        Warehouse,
        fields=['name', 'owner', 'address'],
        page=page,
        paginate_by=paginate_by,
        template_name='stock/warehouse_list.html',
        **kwargs
    )
Example #23
0
def deliverynote_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a delivery note list.
    """
    return filtered_list_detail(
        request,
        Document.objects.get_for_content(DeliveryNote),
        fields=['code', 'author', 'created', 'owner'],
        page=page,
        paginate_by=paginate_by,
        template_name='stock/deliverynote_list.html',
        **kwargs
    )
Example #24
0
def bankaccount_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a bank account list.
    """
    return filtered_list_detail(
        request,
        BankAccount,
        fields=['bank_name', 'bic', 'iban', 'owner'],
        page=page,
        paginate_by=paginate_by,
        template_name='sales/bankaccount_list.html',
        **kwargs
    )
Example #25
0
def product_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a product list.
    """
    return filtered_list_detail(
        request,
        Product,
        fields=['name', 'code', 'ean13', 'description', 'is_consumable', 'is_service'],
        page=page,
        paginate_by=paginate_by,
        template_name='products/product_list.html',
        **kwargs
    )
Example #26
0
def salesinvoice_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a sales invoice list.
    """
    return filtered_list_detail(
        request,
        Document.objects.get_for_content(SalesInvoice),
        fields=['code', 'author', 'created', 'owner'],
        page=page,
        paginate_by=paginate_by,
        template_name='sales/salesinvoice_list.html',
        **kwargs
    )
Example #27
0
def user_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all active users.
    """
    return filtered_list_detail(
        request,
        MyUser.objects.all(),
        fields=['username', 'first_name', 'last_name', 'is_active', 'is_staff', 'is_superuser', 'last_login'],
        paginate_by=paginate_by,
        page=page,
        template_name='auth/user_list.html',
        **kwargs
    )
Example #28
0
def unplanned_task_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered tasks.
    """
    return filtered_list_detail(
        request,
        Task.objects.unplanned(user=request.user),
        paginate_by=paginate_by,
        page=page,
        fields=['title', 'created', 'closed'],
        template_name='todo/unplanned_task_list.html',
        **kwargs
    )
Example #29
0
def partner_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a partner list.
    """
    return filtered_list_detail(
        request,
        Partner,
        fields=["name", "is_managed", "is_supplier", "is_customer", "lead_status", "vat_number", "email"],
        page=page,
        paginate_by=paginate_by,
        template_name="partners/partner_list.html",
        **kwargs
    )
Example #30
0
def letter_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a letter list.
    """
    return filtered_list_detail(
        request,
        Document.objects.get_for_content(Letter),
        fields=['code', 'author', 'created', 'owner'],
        page=page,
        paginate_by=paginate_by,
        template_name='partners/letter_list.html',
        **kwargs
    )
Example #31
0
def partner_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a partner list.
    """
    return filtered_list_detail(
        request,
        Partner,
        fields=['name', 'is_managed', 'is_supplier', 'is_customer', 'lead_status', 'vat_number', 'email'],
        page=page,
        paginate_by=paginate_by,
        template_name='partners/partner_list.html',
        **kwargs
    )
def expensevoucher_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all filtered expensevouchers.
    """
    return filtered_list_detail(
        request,
        Document.objects.get_for_content(ExpenseVoucher),
        fields=['code', 'author', 'created', 'owner', 'status'],
        paginate_by=paginate_by,
        page=page,
        template_name='hr/expensevoucher_list.html',
        **kwargs
    )
Example #33
0
def movement_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a movement list.
    """
    return filtered_list_detail(
        request,
        Movement,
        fields=['id', 'origin', 'destination', 'product_entry', 'created'],
        page=page,
        paginate_by=paginate_by,
        template_name='stock/movement_list.html',
        **kwargs
    )
Example #34
0
def milestone_list(request, project, page=0, paginate_by=5, **kwargs):
    """Displays the list of all milestones of a specified project.
    """
    project = get_object_or_404(Project, code=project)
    return filtered_list_detail(
        request,
        project.milestone_set.all(),
        fields=['code', 'title', 'parent', 'author', 'manager', 'created', 'deadline', 'closed'],
        paginate_by=paginate_by,
        page=page,
        extra_context={'object': project},
        **kwargs
    )
Example #35
0
def page_revisions(request, slug, page=0, paginate_by=10, **kwargs):
    """Displays the list of revisions for the selected page.
    """
    object = get_object_or_404(WikiPage, slug=slug)
    return filtered_list_detail(
        request,
        object.revisions.all(),
        fields=['slug', 'body', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        template_name='knowledge/wikipage_revisions.html',
        extra_context={'object': object},
        **kwargs)
Example #36
0
def product_list(request, page=0, paginate_by=10, **kwargs):
    """Shows a product list.
    """
    return filtered_list_detail(request,
                                Product,
                                fields=[
                                    'name', 'code', 'ean13', 'description',
                                    'is_consumable', 'is_service'
                                ],
                                page=page,
                                paginate_by=paginate_by,
                                template_name='products/product_list.html',
                                **kwargs)
Example #37
0
def page_revisions(request, slug, page=0, paginate_by=10, **kwargs):
    """Displays the list of revisions for the selected page.
    """
    object = get_object_or_404(WikiPage, slug=slug)
    return filtered_list_detail(
        request,
        object.revisions.all(),
        fields=['slug', 'body', 'author', 'created'],
        paginate_by=paginate_by,
        page=page,
        template_name='knowledge/wikipage_revisions.html',
        extra_context={'object': object},
        **kwargs
    )
Example #38
0
def event_list(request, year=None, month=None, day=None, page=0, paginate_by=10, **kwargs):
    """Displays the list of all calendar for the request user.
    """
    return filtered_list_detail(
        request,
        Event.objects.for_user(request.user),
        paginate_by=paginate_by,
        page=page,
        fields=['title', 'start', 'end', 'created'],
        extra_context={
            'current_day': _current_day(year, month, day),
        },
        **kwargs
    )
Example #39
0
def user_list(request, page=0, paginate_by=10, **kwargs):
    """Displays the list of all active users.
    """
    return filtered_list_detail(request,
                                MyUser.objects.all(),
                                fields=[
                                    'username', 'first_name', 'last_name',
                                    'is_active', 'is_staff', 'is_superuser',
                                    'last_login'
                                ],
                                paginate_by=paginate_by,
                                page=page,
                                template_name='auth/user_list.html',
                                **kwargs)
Example #40
0
def partner_contacts(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the partner's contacts.
    """
    partner = get_object_or_404(Partner, pk=id)

    return filtered_list_detail(
        request,
        partner.job_set.all(),
        exclude=["id", "partner"],
        paginate_by=paginate_by,
        page=page,
        extra_context={"object": partner},
        template_name="partners/partner_contacts.html",
    )
Example #41
0
def partner_contacts(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the partner's contacts.
    """
    partner = get_object_or_404(Partner, pk=id)

    return filtered_list_detail(
        request,
        partner.job_set.all(),
        exclude=['id', 'partner'],
        paginate_by=paginate_by,
        page=page,
        extra_context={'object': partner},
        template_name='partners/partner_contacts.html'
    )
Example #42
0
def milestone_list(request, project, page=0, paginate_by=5, **kwargs):
    """Displays the list of all milestones of a specified project.
    """
    project = get_object_or_404(Project, code=project)
    return filtered_list_detail(request,
                                project.milestone_set.all(),
                                fields=[
                                    'code', 'title', 'parent', 'author',
                                    'manager', 'created', 'deadline', 'closed'
                                ],
                                paginate_by=paginate_by,
                                page=page,
                                extra_context={'object': project},
                                **kwargs)
Example #43
0
def warehouse_movements(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the warehouse's movements.
    """
    warehouse = get_object_or_404(Warehouse, pk=id)

    return filtered_list_detail(
        request,
        Movement.objects.for_warehouse(warehouse),
        fields=['id', 'origin', 'destination', 'product_entry', 'created'],
        page=page,
        paginate_by=paginate_by,
        template_name='stock/warehouse_movements.html',
        extra_context={'object': warehouse},
        **kwargs)
Example #44
0
def product_supplies(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the product's supplies.
    """
    product = get_object_or_404(Product, pk=id)

    return filtered_list_detail(
        request,
        product.supply_set.all(),
        fields=['id', 'supplier', 'purchase_price', 'minimal_quantity', 'max_purchase_discount', 'payment_terms'],
        page=page,
        paginate_by=paginate_by,
        template_name='products/product_supplies.html',
        extra_context={'object': product},
        **kwargs
    )
Example #45
0
def warehouse_movements(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the warehouse's movements.
    """
    warehouse = get_object_or_404(Warehouse, pk=id)

    return filtered_list_detail(
        request,
        Movement.objects.for_warehouse(warehouse),
        fields=['id', 'origin', 'destination', 'product_entry', 'created'],
        page=page,
        paginate_by=paginate_by,
        template_name='stock/warehouse_movements.html',
        extra_context={'object': warehouse},
        **kwargs
    )
Example #46
0
def ticket_list(request, project, page=0, paginate_by=5, **kwargs):
    """Displays the list of all tickets of a specified project.
    """
    project = get_object_or_404(Project, code=project)
    return filtered_list_detail(
        request,
        project.tickets.all(),
        fields=['code', 'title', 'parent', 'author', 'manager', 'created', 'closed', 'urgency', 'status'],
        paginate_by=paginate_by,
        page=page,
        extra_context={
            'object': project,
        },
        **kwargs
    )
Example #47
0
def bookmark_list(request, username, page=0, paginate_by=10, **kwargs):
    """Displays the list of all bookmarks for the current user.
    """
    user = get_object_or_404(User, username=username)

    return filtered_list_detail(
        request,
        Bookmark.objects.filter(menu=user.get_profile().bookmarks),
        fields=['title', 'url', 'description', 'new_window'],
        paginate_by=paginate_by,
        page=page,
        extra_context={
            'object': user,
        },
        template_name='menus/bookmark_list.html',
        **kwargs)
Example #48
0
def bookmark_list(request, username, page=0, paginate_by=10, **kwargs):
    """Displays the list of all bookmarks for the current user.
    """
    user = get_object_or_404(User, username=username)

    return filtered_list_detail(
        request,
        Bookmark.objects.filter(menu=user.get_profile().bookmarks),
        fields=['title', 'url', 'description', 'new_window'],
        paginate_by=paginate_by,
        page=page,
        extra_context={
            'object': user,
        },
        template_name='menus/bookmark_list.html',
        **kwargs
    )
Example #49
0
def product_supplies(request, id, page=0, paginate_by=10, **kwargs):
    """Shows the product's supplies.
    """
    product = get_object_or_404(Product, pk=id)

    return filtered_list_detail(request,
                                product.supply_set.all(),
                                fields=[
                                    'id', 'supplier', 'purchase_price',
                                    'minimal_quantity',
                                    'max_purchase_discount', 'payment_terms'
                                ],
                                page=page,
                                paginate_by=paginate_by,
                                template_name='products/product_supplies.html',
                                extra_context={'object': product},
                                **kwargs)
Example #50
0
def hardcopy_list(request, id, page=0, paginate_by=10, **kwargs):
    """Displays the list of all hard copies of the given document.
    """
    document = get_object_or_404(Document, id=id)

    return filtered_list_detail(
        request,
        HardCopy.objects.filter(document=document),
        paginate_by=paginate_by,
        page=page,
        fields=['file', 'language', 'created'],
        extra_context={
            'object': document,
        },
        template_name=kwargs.pop('template_name', '%s/%s_hardcopies.html' % (document.content_type.app_label, document.content_type.model)),
        **kwargs
    )
Example #51
0
def ticket_list(request, project, page=0, paginate_by=5, **kwargs):
    """Displays the list of all tickets of a specified project.
    """
    project = get_object_or_404(Project, code=project)
    return filtered_list_detail(request,
                                project.tickets.all(),
                                fields=[
                                    'code', 'title', 'parent', 'author',
                                    'manager', 'created', 'closed', 'urgency',
                                    'status'
                                ],
                                paginate_by=paginate_by,
                                page=page,
                                extra_context={
                                    'object': project,
                                },
                                **kwargs)
Example #52
0
def milestone_tickets(request, project, code, page=0, paginate_by=5, **kwargs):
    """Displays the list of all tickets of a specified milestone.
    """
    project = get_object_or_404(Project, code=project)
    milestone = get_object_or_404(Milestone, code=code)
    return filtered_list_detail(
        request,
        milestone.tickets.all(),
        fields=['id', 'title', 'parent', 'author', 'manager', 'created', 'closed', 'urgency', 'status'],
        paginate_by=paginate_by,
        page=page,
        extra_context={
            'project': project,
            'object': milestone
        },
        template_name='projects/milestone_tickets.html',
        **kwargs
    )
Example #53
0
def hardcopy_list(request, id, page=0, paginate_by=10, **kwargs):
    """Displays the list of all hard copies of the given document.
    """
    document = get_object_or_404(Document, id=id)

    return filtered_list_detail(
        request,
        HardCopy.objects.filter(document=document),
        paginate_by=paginate_by,
        page=page,
        fields=['file', 'language', 'created'],
        extra_context={
            'object': document,
        },
        template_name=kwargs.pop(
            'template_name', '%s/%s_hardcopies.html' %
            (document.content_type.app_label, document.content_type.model)),
        **kwargs)