Esempio n. 1
0
from photos.views import generic_photos

from inventory import location_filter

from assets import state_filter
from models import Item, ItemGroup, Person, State
from forms import ItemForm, ItemForm_view, ItemGroupForm, ItemGroupForm_view, PersonForm, PersonForm_view
from conf import settings as asset_settings                             

                                
urlpatterns = patterns('assets.views',
    url(r'^person/(?P<object_id>\d+)/photos/$', generic_photos, {'model':Person, 'max_photos':asset_settings.MAX_PERSON_PHOTOS, 'extra_context':{'object_name':_(u'person')}}, 'person_photos'), 
    url(r'^person/(?P<pk>\d+)/$', ExtraDetailView.as_view(form_class=PersonForm_view, queryset=Person.objects.all(), extra_context={'sidebar_subtemplates':['generic_photos_subtemplate.html']}), name='person_view'),
    url(r'^person/list/$', ExtraListView.as_view(queryset=Person.objects.all(), list_filters=[location_filter], extra_context={'title':_(u'people')}), name='person_list'),
    url(r'^person/create/$', ExtraCreateView.as_view(form_class=PersonForm, template_name='generic_form.html'), name='person_create'),
    url(r'^person/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(form_class=PersonForm, queryset=Person.objects.all(), template_name='generic_form.html'), name='person_update'),
    url(r'^person/(?P<pk>\d+)/delete/$', ExtraDeleteView.as_view(model=Person, post_delete_redirect='person_list', extra_context={'object_name':_(u'person')}), name='person_delete'),
    url(r'^person/(?P<pk>\d+)/assign/$', 'person_assign_remove_item', (), 'person_assign_item'),

    url(r'^asset/create/$', ExtraCreateView.as_view(form_class=ItemForm, template_name='generic_form.html'), name='item_create'),
    url(r'^asset/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(form_class=ItemForm, queryset=Item.objects.all(), template_name='generic_form.html', extra_context={'object_name':_(u'asset')}), name='item_update'),
    url(r'^asset/(?P<pk>\d+)/delete/$', ExtraDeleteView.as_view(model=Item, success_url=reverse_lazy("item_list"), extra_context={'object_name':_(u'asset')}), name='item_delete'),
    url(r'^asset/(?P<object_id>\d+)/assign/$', 'item_assign_remove_person', (), name='item_assign_person'),
    url(r'^asset/orphans/$', ExtraListView.as_view(queryset=Item.objects.filter(person=None), list_filters=[location_filter], extra_context=dict(title=_(u'orphan assets'))), name='item_orphans_list'),
    url(r'^asset/list/$', ExtraListView.as_view(queryset=Item.objects.all(), list_filters=[location_filter, state_filter], extra_context=dict(title=_(u'assets'))), name='item_list'),
    url(r'^asset/(?P<pk>\d+)/$', ExtraDetailView.as_view(form_class=ItemForm_view, queryset=Item.objects.all(), extra_context={'object_name':_(u'asset'), 'sidebar_subtemplates':['generic_photos_subtemplate.html', 'state_subtemplate.html']}, extra_fields=[{'field':'get_owners', 'label':_(u'Assigned to:')}]), name='item_view'),
    url(r'^asset/(?P<object_id>\d+)/photos/$', generic_photos, {'model':Item, 'max_photos':asset_settings.MAX_ASSET_PHOTOS, 'extra_context':{'object_name':_(u'asset')}}, 'item_photos'), 
    url(r'^asset/(?P<object_id>\d+)/state/(?P<state_id>\d+)/set/$', 'item_setstate', name='item_setstate'),
    url(r'^asset/(?P<object_id>\d+)/state/(?P<state_id>\d+)/unset$', 'item_remove_state', name='item_remove_state'),

    url(r'^group/list/$', ExtraListView.as_view(queryset=ItemGroup.objects.all(), extra_context=dict(title=_(u'item groups'))), name='group_list'),
Esempio n. 2
0
                   Inventory, Log, Location, Supplier
                   
from forms import InventoryTransactionForm, InventoryForm, \
                  ItemTemplateForm, ItemTemplateForm_view, LogForm, \
                  SupplierForm, LocationForm_view

from common.views import ExtraListView, ExtraDetailView, ExtraCreateView, ExtraUpdateView, ExtraDeleteView
from inventory.views import TemplateItemsView

from conf import settings as inventory_settings
                                

urlpatterns = patterns('inventory.views',
    url(r'^template/list/$', ExtraListView.as_view(queryset=ItemTemplate.objects.all(), extra_context=dict(title=_(u'item template'))), name='template_list'),
    url(r'^template/create/$', ExtraCreateView.as_view(form_class=ItemTemplateForm, template_name='generic_form.html', extra_context={'object_name':_(u'item template')}), name='template_create'),
    url(r'^template/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(form_class=ItemTemplateForm, queryset=ItemTemplate.objects.all(), template_name='generic_form.html', extra_context={'object_name':_(u'item template')}), name='template_update' ),
    url(r'^template/(?P<pk>\d+)/delete/$', ExtraDeleteView.as_view(), dict({'model':ItemTemplate}, success_url=reverse_lazy("template_list"), extra_context=dict(object_name=_(u'item template'), _message=_(u"Will be deleted from any user that may have it assigned and from any item group."))), name='template_delete' ),
    url(r'^template/orphans/$', ExtraListView.as_view(queryset=ItemTemplate.objects.filter(item=None), extra_context=dict(title=_('orphan templates'))), name='template_orphans_list'),
    url(r'^template/(?P<object_id>\d+)/photos/$', generic_photos, {'model':ItemTemplate, 'max_photos':inventory_settings.MAX_TEMPLATE_PHOTOS, 'extra_context':{'object_name':_(u'item template')}}, name='template_photos'), 
    url(r'^template/(?P<pk>\d+)/$', ExtraDetailView.as_view(form_class=ItemTemplateForm_view, queryset=ItemTemplate.objects.all(), extra_context={'object_name':_(u'item template'), 'sidebar_subtemplates':['generic_photos_subtemplate.html']}), name='template_view'),
    #url(r'^template/(?P<object_id>\d+)/items/$', 'template_items', name='template_items_list'),
    url(r'^template/(?P<pk>\d+)/items/$', TemplateItemsView.as_view(), name='template_items_list'),
    url(r'^template/(?P<object_id>\d+)/assign/supplies$', 'template_assign_remove_supply', name='template_assign_supply'),
    url(r'^template/(?P<object_id>\d+)/assign/suppliers/$', 'template_assign_remove_suppliers', name='template_assign_suppliers'),

    url(r'^inventory/list/$', ExtraListView.as_view(queryset=Inventory.objects.all(), extra_context=dict(title=_(u'inventories'), extra_columns=[{'name':_(u'location'), 'attribute':'location'}])), name='inventory_list'),
    url(r'^inventory/create/$', ExtraCreateView.as_view(model=Inventory, template_name='generic_form.html', extra_context={'object_name':_(u'inventory')}), name='inventory_create'),
    url(r'^inventory/(?P<object_id>\d+)/$', 'inventory_view', name='inventory_view'),
    url(r'^inventory/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(form_class=InventoryForm, queryset=Inventory.objects.all(), template_name='generic_form.html', extra_context={'object_name':_(u'inventory')}), name='inventory_update'),
    url(r'^inventory/(?P<pk>\d+)/delete/$', ExtraDeleteView.as_view(model=Inventory, success_url=reverse_lazy("inventory_list"), extra_context=dict(object_name=_(u'inventory'))), name='inventory_delete'),
    #url(r'^inventory/(?P<pk>\d+)/current/$', 'inventory_current', (), 'inventory_current'),
Esempio n. 3
0
from models import PurchaseRequestStatus, PurchaseRequest, \
                   PurchaseRequestItem, PurchaseOrderStatus, \
                   PurchaseOrderItemStatus, PurchaseOrder, \
                   PurchaseOrderItem

from movements import purchase_request_state_filter, \
                      purchase_order_state_filter

from forms import PurchaseRequestForm, PurchaseOrderForm, PurchaseOrderItemForm
from common.views import ExtraListView, ExtraDetailView, ExtraCreateView, ExtraUpdateView, ExtraDeleteView

urlpatterns = patterns('movements.views',
    url(r'^purchase/request/state/list/$', ExtraListView.as_view(queryset=PurchaseRequestStatus.objects.all(), extra_context={'title':_(u'purchase request states')}), name='purchase_request_state_list'),
    url(r'^purchase/request/state/create/$', ExtraCreateView.as_view(model=PurchaseRequestStatus, template_name='generic_form.html', extra_context={'title':_(u'create new purchase request state')}), name='purchase_request_state_create'),
    url(r'^purchase/request/state/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(model=PurchaseRequestStatus, template_name='generic_form.html'), name='purchase_request_state_update'),
    url(r'^purchase/request/state/(?P<object_id>\d+)/delete/$', ExtraDeleteView.as_view(model=PurchaseRequestStatus, success_url=reverse_lazy("purchase_request_state_list"), extra_context=dict(object_name=_(u'purchase request state'))), name='purchase_request_state_delete'),

    url(r'^purchase/request/list/$', ExtraListView.as_view(queryset=PurchaseRequest.objects.all(), list_filters=[purchase_request_state_filter], extra_context=dict(title =_(u'purchase requests'), extra_columns = [{'name':_(u'Active'), 'attribute':lambda x: _(u'Open') if x.active == True else _(u'Closed')}])), name='purchase_request_list'),
    url(r'^purchase/request/(?P<object_id>\d+)/$', 'purchase_request_view', (), 'purchase_request_view'),
    url(r'^purchase/request/create/$', ExtraCreateView.as_view(form_class=PurchaseRequestForm, template_name='generic_form.html', extra_context={'title':_(u'create new purchase request')}), name='purchase_request_create'),
    url(r'^purchase/request/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(form_class=PurchaseRequestForm, queryset=PurchaseRequest.objects.all(), template_name='generic_form.html'), name='purchase_request_update'),
    url(r'^purchase/request/(?P<object_id>\d+)/delete/$', ExtraDeleteView.as_view(model=PurchaseRequest, success_url=reverse_lazy("purchase_request_list"), extra_context=dict(object_name=_(u'purchase request'))), name='purchase_request_delete'),
    url(r'^purchase/request/(?P<object_id>\d+)/close/$', 'purchase_request_close', (), 'purchase_request_close'),
    url(r'^purchase/request/(?P<object_id>\d+)/open/$', 'purchase_request_open', (), 'purchase_request_open'),
    url(r'^purchase/request/(?P<object_id>\d+)/purchase_order_wizard/$', 'purchase_order_wizard', (), 'purchase_order_wizard'),

    url(r'^purchase/request/(?P<object_id>\d+)/add_item/$', 'purchase_request_item_create', (), 'purchase_request_item_create'),
    url(r'^purchase/request/item/(?P<pk>\d+)/update/$', ExtraUpdateView.as_view(model=PurchaseRequestItem, template_name='generic_form.html'), name='purchase_request_item_update'),
    url(r'^purchase/request/item/(?P<object_id>\d+)/delete/$', ExtraDeleteView.as_view(model=PurchaseRequestItem, success_url=reverse_lazy("purchase_request_list"), extra_context=dict(object_name=_(u'purchase request item'))), name='purchase_request_item_delete'),