Exemplo n.º 1
0
def delete_person(request, pk):
    person = get_object_or_404(Person, pk=pk)
    if person.can_delete():
        success_url = reverse_lazy('phone_book:contacts')
        delete_view = DeleteView.as_view(model=Person, success_url=success_url)
        return delete_view(request, pk=pk)
    else:
        context = {'request': request, 'person': person}
        return render(request, 'phone_book/person_cannot_delete.html', context)
Exemplo n.º 2
0
def route(request, view_kwargs={}, pk=None):
    """
    Route to the correct view based on Method or the existance of
    pk.
    """

    if request.method == "DELETE":
        return DeleteView.as_view(**view_kwargs)(request=request, pk=pk)
    else:
        if pk:
            return UpdateView.as_view(**view_kwargs)(request=request, pk=pk)
        else:
            return CreateView.as_view(**view_kwargs)(request=request)
Exemplo n.º 3
0
def delete_event(request, event_id, next=None, login_required=True):
    """
    After the event is deleted there are three options for redirect, tried in
    this order:

    # Try to find a 'next' GET variable
    # If the key word argument redirect is set
    # Lastly redirect to the event detail of the recently create event
    """
    event = get_object_or_404(Event, id=event_id)
    next = next or reverse('day_calendar', args=[event.calendar.slug])
    next = get_next_url(request, next)
    return DeleteView.as_view(request,
                         model = Event,
                         object_id = event_id,
                         post_delete_redirect = next,
                         template_name = "schedule/delete_event.html",
                         extra_context = dict(next=next),
                         login_required = login_required
                        )
Exemplo n.º 4
0
            template_name='geneafamilycore/member/forms/update_member.html'),
        name='update_member'),

    # Update instruction
    url(r'^member/instruction/(?P<pk>\d+)/update$',
        UpdateView.as_view(
            model=Member,
            form_class=MemberInstructionForm,
            template_name=
            'geneafamilycore/member/forms/update_instruction_member.html'),
        name='update_instruction_member'),

    # Delete member
    url(r'^member/(?P<pk>\d+)/delete$',
        DeleteView.as_view(
            model=Member,
            template_name='geneafamilycore/member/forms/delete_member.html',
            success_url='/'),
        name='delete_member'),

    # Member's detail
    url(r'^member/(?P<pk>\d+)$',
        MemberDetail.as_view(
            model=Member,
            template_name='geneafamilycore/member/member_detail.html'),
        name='member_detail'),

    # All Members
    url(r'^member/all$',
        ListView.as_view(
            model=Member,
            paginate_by=20,
Exemplo n.º 5
0
        CreateView.as_view(
            model = Entry,
            success_url = '/entries/',
            template_name = 'entries/entry_form.html',
            form_class = HTML5Form)),
    url(r'^detail/(?P<pk>\d+)/$',
        DetailView.as_view(
            model = Entry,
            template_name = 'entries/entry_detail.html'),
        name = "entry_detail"),
    url(r'^update/(?P<pk>\d+)/$',
        UpdateView.as_view(
            model = Entry,
            template_name = 'entries/entry_form.html',
            form_class = HTML5Form)),
    url(r'^delete/(?P<pk>\d+)/$',
        DeleteView.as_view(
            model = Entry,
            success_url = '/entries/',
            template_name = 'entries/entry_confirm_delete.html')),
)

urlpatterns += patterns('',
    (r'^login/$', 'django.contrib.auth.views.login',
        {'template_name':'entries/registration/login.html'}),
    (r'^logout/$', 'django.contrib.auth.views.logout',
        {'template_name':'entries/registration/logout.html'}),
)

urlpatterns += staticfiles_urlpatterns()
Exemplo n.º 6
0
Arquivo: urls.py Projeto: zhwei/qipei
    url(
        r'^delete/(?P<product_id>\d+)$',
        'views.delete_product',
        name="delete_product",
    ),

    ## 分类
    url(r'^sort/list$', 'views.show_sort', name="list_sort"),
    url(r'^sort/create/(?P<parent>\w+)/$',
        'views.add_sort',
        name="create_sort"),
    url(
        r'^sort/delete/(?P<pk>\d+)/$',
        DeleteView.as_view(
            model=Sorts,
            context_object_name="foo",
            template_name="confirm_delete.html",
            success_url=reverse_lazy("list_sort"),
        ),
        name="delete_sort",
    ),

    ## 友情链接
    url(r'^links/list$',
        ListView.as_view(
            queryset=Links.objects.all(),
            context_object_name="links",
            template_name="list_link.html",
        ),
        name='list_link'),
    url(r'^links/create',
        CreateView.as_view(
Exemplo n.º 7
0
    ), name="golfstats-courses-arenas-create"),

    url(r'^arenas/(?P<pk>\d+)/$', ArenaDetailView.as_view(
        model=Arena,
        context_object_name="arena",
    ), name="golfstats-courses-arenas-detail"),

    url(r'^arenas/(?P<pk>\d+)/edit/', UpdateView.as_view(
        model=Arena,
        context_object_name="arena",
        success_url=reverse_lazy('golfstats-courses-arenas'),
    ), name="golfstats-courses-arenas-edit"),

    url(r'^arenas/(?P<pk>\d+)/delete/$', DeleteView.as_view(
        model=Arena,
        context_object_name="arena",
        success_url=reverse_lazy('golfstats-courses-arenas'),
    ), name="golfstats-courses-arenas-delete"),

    # Tees
    url(r'^tees/$', ListView.as_view(
        model=Tee,
        context_object_name="tees",
    ), name="golfstats-courses-tees"),

    url(r'^tees/create/$', CreateView.as_view(
        model=Tee,
        success_url=reverse_lazy('golfstats-courses-tees'),
    ), name="golfstats-courses-tee-create"),

    url(r'^tees/(?P<pk>\d+)/$', DetailView.as_view(
Exemplo n.º 8
0
from django.urls import path, reverse_lazy
from django.views.generic import ListView, DeleteView, DetailView

from bookmark.models import Bookmark
from bookmark.views import BookmarkCreateView, BookmarkUpdateView

app_name = "bookmark"

urlpatterns = [
    path('', ListView.as_view(model=Bookmark, paginate_by=5), name="index"),
    path('add/', BookmarkCreateView.as_view(), name="add"),
    path(
        'delete/<int:pk>/',
        DeleteView.as_view(
            model=Bookmark,
            success_url=reverse_lazy('bookmark:index'),
        ),
        name="delete",
    ),
    path('detail/<int:pk>', DetailView.as_view(model=Bookmark), name="detail"),
    path('update/<int:pk>', BookmarkUpdateView.as_view(), name="update"),
]
Exemplo n.º 9
0
        PartDetailView.as_view(),
        name='part'),
    url(r'^vendor/$',
        ListView.as_view(queryset=Vendor.objects.all(),
                         template_name='vendor_list.html'),
        name='vendors'),
    url(r'^vendor/edit/$',
        CreateView.as_view(model=Vendor,
                           form_class=VendorForm,
                           template_name='edit_vendor.html'),
        name='edit_vendor'),
    url(r'^vendor/edit/(?P<slug>\S+)/$',
        UpdateView.as_view(model=Vendor,
                           form_class=VendorForm,
                           slug_field='name',
                           template_name='edit_vendor.html'),
        name='edit_vendor'),
    url(r'^vendor/delete/(?P<slug>\S+)/$',
        DeleteView.as_view(model=Vendor,
                           slug_field='name',
                           template_name='delete.html',
                           success_url=reverse_lazy('vendors')),
        name='del_vendor'),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # url(r'^admin/', include(admin.site.urls)),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 10
0
			},
			template_name = "parcel/admin/list.html")),
		name = "parcel_list"),
	url(r'^new',
		user_is_staff(YSCreateView.as_view(
			model = Parcel,
			form_class = ParcelAdminForm,
			template_name = "parcel/admin/update.html",
			success_url = "parcel_list")),
		name = "parcel_new"),
	url(r'^(?P<pk>[0-9]+)$',
		user_is_staff(UpdateView.as_view(
			model = Parcel,
			form_class = ParcelAdminForm,
			template_name = "parcel/admin/update.html",
			success_url = "list")),
		name = "parcel_update"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = Parcel,
			template_name= "parcel/admin/del.html",
			success_url="../list")),
		name = "parcel_del"),
	url(r'query_owners',
		user_is_staff(queryParcelOwners),
		name = "parcel_query_owners"),
	url(r'quick_store',
		user_is_staff(packageQuickStore),
		name = "parcel_quick_store"),
]
Exemplo n.º 11
0
from django.contrib.auth.decorators import login_required
from core.models import News, Category, Event, Product
from core.views import NewsCreate, NewsUpdate, EventCreate, ProductCreate, ClassificationList
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = patterns('',
    url(r'^usuarios/$', login_required(ListView.as_view(template_name="users.html", model=User,
                                                        paginate_by=20)), name='users'),
    url(r'^agregar-usuario/$', login_required(CreateView.as_view(
        model=User, form_class=UserForm, template_name="user_form.html", success_url='/usuarios/')),
        name='create_user'),
    url(r'^modificar-usuario/(?P<pk>\d+)/$', login_required(UpdateView.as_view(
        model=User, form_class=UserUpdateForm, template_name="user_form.html", success_url='/usuarios/')),
        name='update_user'),
    url(r'^eliminar-usuario/(?P<pk>\d+)/$', login_required(DeleteView.as_view(
        model=User, success_url='/usuarios/')), name='delete_user'),
    url(r'^iniciar-sesion/$', auth_views.login, {'template_name': 'user/login_logout_register/sign-in.html'},
        name='auth_login'),
    url(r'^cerrar-sesion/$', auth_views.logout, {'next_page': '/iniciar-sesion/'},
        name='auth_logout'),
    #Noticias
    url(r'^noticias/$', login_required(ListView.as_view(template_name="news.html", model=News,
                                                        paginate_by=20)), name='news'),
    url(r'^agregar-noticia/$', login_required(NewsCreate.as_view()), name='create_news'),
    url(r'^modificar-noticia/(?P<pk>\d+)/$', login_required(NewsUpdate.as_view()), name='update_news'),
    url(r'^eliminar-noticia/(?P<pk>\d+)/$', login_required(DeleteView.as_view(
        model=News, success_url='/noticias/')), name='delete_news'),
    #Categorias
    url(r'^categorias/$', login_required(ListView.as_view(template_name="categories.html", model=Category,
                                                          paginate_by=20)), name='categories'),
    url(r'^agregar-categoria/$', login_required(CreateView.as_view(
Exemplo n.º 12
0
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import DeleteView, ListView

import views
# from views import OpenStackHypervisorsView, OpenStackHypervisorDetailView
from models import OpenStackAgent


urlpatterns = [
    url(r'^index/$', ListView.as_view(model=OpenStackAgent,template_name='openstack/index.html') ,name='openstack_index'),
    url(r'^add/$', views.OpenStackAgentAddView.as_view() ,name='openstack_agent_add'),
    # url(r'^(?P<pk>\d+)/$', views.OpenStackHypervisorsView.as_view() ,name='hypervisors'),
    url(r'^(?P<pk>\d+)/edit/$', views.OpenStackAgentEditView.as_view() ,name='openstack_agent_edit'),
    url(r'^(?P<pk>\d+)/delete/$',
        DeleteView.as_view(model=OpenStackAgent,
                           success_url=reverse_lazy('newtouch:openstack:openstack_index')) ,name='openstack_agent_delete'),

    url(r'^hypervisors/$', views.OpenStackHypervisorsView.as_view() ,name='hypervisors'),
    url(r'^hypervisors/(?P<hypervisor_hostname>\w+)/$', views.OpenStackHypervisorDetailView.as_view(), name='openstack_hypervisors_detail'),

    url(r'^net/(?P<pk>\d+)/$', views.OpenStackNetStatus.as_view() ,name='net'),

#     url(r'^(?P<pk>\d+)/uuid/$', views.InstanceUUID.as_view() ,name='instance_uuid'),
    url(r'^uuid/$', views.InstanceUUID.as_view() ,name='instance_uuid'),
    url(r'^detail/$', views.InstanceDetailView.as_view() ,name='instance_detail'),
    url(r'^data/$', views.ChartData.as_view() ,name='instance_data'),
]
Exemplo n.º 13
0
#web 2.0
   # Crear Escola, equip, reglament, instalacions 
    url(r'^escola/Crear/$',EscolaCreate.as_view(),name='escola_create'),
    url(r'^equip/Crear/$',EquipCreate.as_view(),name='equip_create'),
    url(r'^reglament/Crear/$',ReglamentCreate.as_view(),name='reglament_create'),
    url(r'^instalacions/Crear/$',InstalacioCreate.as_view(),name='instalacio_create'),
       
    #   Edit    
    url(r'^escola/(?P<pk>\d+)/edit/$',login_required(UpdateView.as_view(model = Escole,template_name = 'form.html',form_class = EscolaForm)),name='escola_edit'),
    url(r'^equip/(?P<pk>\d+)/edit/$',login_required(UpdateView.as_view(model = Equip,template_name = 'form.html',form_class = EquipForm)),name='equip_edit'),
    url(r'^instalacions/(?P<pk>\d+)/edit/$',UpdateView.as_view(model = Instalacion,template_name = 'form.html',form_class = InstalacionForm),name='install_edit'),
    url(r'^reglament/(?P<pk>\d+)/edit/$',UpdateView.as_view(model = Reglament,template_name = 'form.html',form_class = ReglamentForm),name='reglament_edit'),

    #Delete 
    url(r'^escola/(?P<pk>\d+)/delete/$',DeleteView.as_view(model= Escole, template_name='delete.html',success_url = '/escola'),name='escola_delete'),
    url(r'^equip/(?P<pk>\d+)/delete/$',DeleteView.as_view(model= Equip, template_name='delete.html',success_url = '/equip'),name='equip_delete'),
    url(r'^instalacions/(?P<pk>\d+)/delete/$',DeleteView.as_view(model= Instalacion, template_name='delete.html',success_url = '/instalacions'),name='install_delete'),
    url(r'^reglament/(?P<pk>\d+)/delete/$',DeleteView.as_view(model= Reglament, template_name='delete.html',success_url = '/reglament'),name='reglament_delete'),

    #review
    #url(r'^equip/(?P<idEquip>\d+)/reviews/create/$', review, name='review_create'), 
    


    url(r'^admin/', include(admin.site.urls)),
) 

#RESTful API
urlpatterns += patterns('',
    url(r'^api/escola/$', APIEscolaList.as_view(), name='escola-list'),
Exemplo n.º 14
0
        paginate_by=30,
    ), name="golfstats-players-players"),

    url(r'^players/create/$', CreateView.as_view(
        model=Player,
        form_class=PlayerForm,
        success_url=reverse_lazy('golfstats-players-players'),
    ), name="golfstats-players-players-create"),

    url(r'^players/(?P<pk>\d+)/$', DetailView.as_view(
        model=Player,
        context_object_name="player",
    ), name="golfstats-players-players-detail"),

    url(r'^players/(?P<pk>\d+)/stats/$', stats,
        name="golfstats-players-players-stats"),

    url(r'^players/(?P<pk>\d+)/edit/', UpdateView.as_view(
        model=Player,
        form_class=PlayerForm,
        context_object_name="player",
        success_url=reverse_lazy('golfstats-players-players'),
    ), name="golfstats-players-players-edit"),

    url(r'^players/(?P<pk>\d+)/delete/$', DeleteView.as_view(
        model=Player,
        context_object_name="player",
        success_url=reverse_lazy('golfstats-players-players'),
    ), name="golfstats-players-players-delete"),
)
Exemplo n.º 15
0
from apps.blog.models import Article
from apps.blog.views import ArticleListView, ArticleUnpublishedListView, ArticleDetailView



urlpatterns = patterns('',
    url('^$', ArticleListView.as_view(), name="article_index"),

    # 'unpublished' and 'new' are prefixed with '.' to prevent clash with a slug like 'new'.
    url('^.unpublished/$',
        login_required(ArticleUnpublishedListView.as_view()),
        name="article_unpublished_index"),

    url(r'^(?P<slug>[\w\d-]+)/$', ArticleDetailView.as_view(), name="article_view"),

    url('^.new/$', # see above comment about '.' prefix.
        login_required(CreateView.as_view(model=Article)),
        name="article_new"),

    url('^(?P<slug>[\w\d-]+)/edit/$',
        login_required(UpdateView.as_view(model=Article, context_object_name="article")),
        name="article_edit"),

    url('^(?P<slug>[\w\d-]+)/delete/$',
        login_required(DeleteView.as_view(model=Article,
                           context_object_name="article",
                           success_url="/blog/")), # @@@ Should be more DRY
        name="article_delete"),
)
Exemplo n.º 16
0
urlpatterns = patterns(
    "",
    url(r'^authors/$',
        ListView.as_view(model=models.Author),
        name='cbvcrudapp-authors'),
    url(r'^author/(?P<pk>\d+)/$',
        DetailView.as_view(model=models.Author),
        name='cbvcrudapp-author-details'),
    url(r'^author/create/$',
        views.InlineObjectsCreateView.as_view(
            main_model=models.Author,
            main_model_fields=('name', ),
            fk_field='books',
            inline_model=models.Book,
            inline_model_fields=('title', ),
            template_name='cbvcrudapp/author_create_with_books.html'),
        name='cbvcrudapp-author-create'),
    url(r'^author/update/(?P<pk>\d+)/$',
        views.InlineObjectsUpdateView.as_view(
            main_model=models.Author,
            main_model_fields=('name', ),
            inline_model=models.Book,
            inline_model_fields=('title', ),
            template_name='cbvcrudapp/author_update_with_books.html'),
        name='cbvcrudapp-author-update'),
    url(r'^author/delete/(?P<pk>\d+)/$',
        DeleteView.as_view(model=models.Author,
                           success_url=reverse_lazy('cbvcrudapp-authors')),
        name='cbvcrudapp-author-delete'))
Exemplo n.º 17
0
def cookbook_delete(url_, name, view=None, model=None):
    if view is None:
        view = DeleteView.as_view(model=model)
    return url(url_, view, name=name)
Exemplo n.º 18
0
from django.views.generic import CreateView, UpdateView, ListView, DetailView, DeleteView
from django import forms
from .models import Post


class PostListView(ListView):
    model = Post
    queryset = Post.objects.all().prefetch_related('tag_set', 'comment_set')
    paginate_by = 10


post_list = PostListView.as_view()

post_detail = DetailView.as_view(model=Post)

post_new = CreateView.as_view(model=Post, fields='__all__')

post_edit = UpdateView.as_view(model=Post, fields='__all__')

post_delete = DeleteView.as_view(model=Post, success_url='/blog/')
Exemplo n.º 19
0

ordem_servico_new = CreateView.as_view(model=OrdemServico,
                                       template_name='sistran/models/ordem_servico/'
                                       'ordem_servico_form.html',
                                       fields=['permissao', 'tipo_servico', 'pago'])


ordem_servico_edit = UpdateView.as_view(model=OrdemServico,
                                        template_name='sistran/models/ordem_servico/'
                                        'ordem_servico_form.html',
                                        fields=['permissao', 'tipo_servico', 'pago'])


ordem_servico_remove = DeleteView.as_view(model=OrdemServico,
                                          template_name='sistran/models/ordem_servico/'
                                          'ordem_servico_confirm_delete.html',
                                          success_url=reverse_lazy('ordem_servico_list'))


def add_street(request):
    street = request.POST.get('new_street')
    Logradouro.objects.create(logradouro=street.upper())
    logradouros = AjaxLogradouroForm()

    return HttpResponse(logradouros)


class ReportPDF(View):
    permissao = get_object_or_404(PermissaoTemProprietario, pk=429)
    endereco = Reside.objects.get(pessoa=permissao.proprietario.id.id.id.id)
Exemplo n.º 20
0
        posts = form.save(commit=False)
        posts.user = self.request.user
        posts.save()
        return super(PostCreateView, self).form_valid(form)


post_new = login_required(
    PostCreateView.as_view(model=Post,
                           form_class=PostForm,
                           template_name='goodcolumn/add_post.html'))
post_edit = login_required(
    UpdateView.as_view(model=Post,
                       form_class=PostForm,
                       template_name='goodcolumn/edit_post.html'))
post_delete = login_required(
    DeleteView.as_view(model=Post,
                       success_url=reverse_lazy('goodcolumn:post_list')))


class CommentCreateView(CreateView):
    model = Comment
    form_class = CommentForm
    template_name = 'goodcolumn/add_comment.html'

    def form_valid(self, form):
        comment = form.save(commit=False)
        comment.post = get_object_or_404(Post, pk=self.kwargs['post_pk'])
        comment.comment_user = self.request.user
        comment.save()
        return super(CommentCreateView, self).form_valid(form)

Exemplo n.º 21
0
def cookbook_delete(url_, name, view=None, model=None):
    if view is None:
        view = DeleteView.as_view(model=model)
    return url(url_, view, name=name)
Exemplo n.º 22
0
from django.conf.urls import url
from django.views.generic import DeleteView
from views import *

urlpatterns = [
    url(r"^overview/$", IndexView.as_view(), name="server_overview"),
    url(r"^monitor/$", MonitorView.as_view(), name="server_monitor"),
    #     url(r'^monitor/(?P<pk>\d+)/$', MonitorDetailView.as_view() ,name='server_detail'),
    url(r"^monitor/detail/$", MonitorDetailView.as_view(), name="server_detail"),
    url(r"^manager/$", ManagerView.as_view(), name="server_manager"),
    url(r"^manager/add/$", ServerAddView.as_view(), name="server_manager_add"),
    url(r"^manager/(?P<pk>\d+)/edit/$", ServerEditView.as_view(), name="server_manager_edit"),
    url(r"^manager/(?P<pk>\d+)/delete/$", ServerDeleteView.as_view(), name="server_manager_delete"),
    url(r"^collector/$", CollectorView.as_view(), name="server_collector"),
    url(r"^collector/(?P<pk>\d+)/$", CollectorView.as_view(), name="server_collector_detail"),
    url(r"^collector/add/$", CollertorAddView.as_view(), name="server_collector_add"),
    url(r"^collector/(?P<pk>\d+)/edit/$", CollertorEditView.as_view(), name="server_collector_edit"),
    url(
        r"^collector/(?P<pk>\d+)/delete/$",
        DeleteView.as_view(model=Collector, success_url=reverse_lazy("newtouch:server:server_collector")),
        name="server_collector_delete",
    ),
    url(r"^rules/$", IndexView.as_view(), name="server_rules"),
    url(r"^chart/$", ChartData.as_view(), name="chart_data"),
    url(r"^host/$", ChartHost.as_view(), name="host_ip"),
]
Exemplo n.º 23
0
        name="detail_video"
    ),
    url(
        r'^test/youtubevideo/detail/(?P<pk>\d+)/$',
        DetailMedia.as_view(
            model=YoutubeVideo,
            template_name='test/youtube/detail.html'
        ),
        name="detail_youtubevideo"
    ),

    # delete
    url(
        r'^test/video/delete/(?P<pk>\d+)/$',
        DeleteView.as_view(
            model=Video,
            success_url=reverse_lazy('list_video')
        ),
        name="delete_video"
    ),
    url(
        r'^test/youtubevideo/delete/(?P<pk>\d+)/$',
        DeleteView.as_view(
            model=YoutubeVideo,
            success_url=reverse_lazy('list_youtubevideo')
        ),
        name="delete_youtubevideo"
    ),

###########################################################
    url(
        r'^test/youtubevideo/multiple/create/$',
Exemplo n.º 24
0
class PostCreateView(CreateView):
    model = Post
    form_class = PostForm
    template_name = 'money/add_post.html'

    def form_valid(self, form):
        posts = form.save(commit=False)
        posts.user = self.request.user
        posts.save()
        return super(PostCreateView, self).form_valid(form)



post_new = login_required(PostCreateView.as_view(model=Post, form_class=PostForm,template_name='money/add_post.html'))
post_edit = login_required(UpdateView.as_view(model=Post, form_class=PostForm,template_name = 'money/edit_post.html'))
post_delete = login_required(DeleteView.as_view(model=Post,success_url=reverse_lazy('money:post_list')))




class CommentCreateView(CreateView):
    model = Comment
    form_class = CommentForm
    template_name = 'money/add_comment.html'

    def form_valid(self, form):
        comment = form.save(commit=False)
        comment.post = get_object_or_404(Post, pk=self.kwargs['post_pk'])
        comment.comment_user = self.request.user
        comment.save()
        return super(CommentCreateView, self).form_valid(form)
Exemplo n.º 25
0

urlpatterns = [
    url(r'^list/$',login_required(RegistrationListView.as_view()), name="cambridge_list"),
    url(r'^list/all$',login_required(RegistrationListViewAll.as_view()), name="cambridge_list_all"),
    url(r'^excel/$',RegistrationExcelView, name="cambridge_excel"),
    url(r'^pay/(?P<pk>\d+)/$',RegistrationPayment,name="cambridge_pay"),
    url(r'^edit/(?P<pk>\d+)/$',
        login_required(UpdateView.as_view(
            model=Registration,
            success_url = '/cambridge/list',
            form_class = RegistrationEditForm,
            template_name='cambridge/registration_edit.html')), name="cambridge_edit"),
    url(r'^delete/(?P<pk>\d+)/$',
        login_required(DeleteView.as_view(
            model=Registration,
            success_url="/cambridge/list/")), name="cambridge_delete"),
    url(r'^view/(?P<pk>\d+)/$', ver, name="cambridge_view"),
    url(r'^print/(?P<pk>\d+)/$', imprimir_cambridge, name="cambridge_imprimir"),
    url(r'^new/(?P<pk>\d+)/$',RegistrationCreateView.as_view()),
    url(r'^new/$',RegistrationCreateView.as_view(), name="cambridge_nueva"),
    
    #Colegios
    url(r'schools/exam/list/$', login_required(SchoolExamList.as_view()),name="cambridge_schools_exam_list"),
    url(r'schools/exam/(?P<school_name>\w+)/new/$', login_required(SchoolExamCreate.as_view()),name="cambridge_schools_exam_new"),
    url(r'schools/list/$', login_required(SchoolListView.as_view()),name="cambridge_schools_list"),
    url(r'schools/registrations/list/$', login_required(SchoolRegistrationListView.as_view()),name="cambridge_schools_registration_list"),
    url(r'schools/new/(?P<school_name>\w+)/(?P<school_password>\w+)/$', SchoolRegistrationCreateView.as_view(),name="cambridge_schools_new_registration"),
    url(r'schools/new/$', SchoolCreateView.as_view(),name="cambridge_schools_new"),
    url(r'berriotxoa/$', TemplateView.as_view( template_name = 'cambridge/berriotxoa.html' ),name="cambridge_berriotxoa"),
    url(r'schools/fuentefresnedo/$', TemplateView.as_view( template_name =  'cambridge/fuentefresnedo.html' ),name="cambridge_fuentefresnedo"),
Exemplo n.º 26
0
from django.core.urlresolvers import reverse_lazy as r
from django.shortcuts import render
from django.views.generic import CreateView, ListView, DetailView
from django.views.generic import UpdateView, DeleteView
from .forms import PersonForm
from .mixins import NameSearchMixin
from .models import Person


def home(request):
    return render(request, 'index.html')


class PersonList(NameSearchMixin, ListView):
    model = Person
    paginate_by = 5


person_detail = DetailView.as_view(model=Person)

person_create = CreateView.as_view(model=Person, form_class=PersonForm)

person_update = UpdateView.as_view(model=Person, form_class=PersonForm)

person_delete = DeleteView.as_view(model=Person,
                                   success_url=r('core:person_list'))
Exemplo n.º 27
0
			model = SponsorMailAttachment,
			fields = [
				"name",
				"attachment",
			],
			template_name = "sponsor/mailattachment/update.html",
			success_url = "list")),
		name = "sponsormailattachment_new"),
	url(r'^(?P<pk>[0-9]+)$',
		user_is_staff(UpdateView.as_view(
			model = SponsorMailAttachment,
			fields = [
				"name",
				"attachment",
			],
			template_name = "sponsor/mailattachment/update.html",
			success_url = "list")),
		name = "sponsormailattachment_update"),
	url(r'^list/?',
		user_is_staff(ListView.as_view(
			queryset = SponsorMailAttachment.objects.all(),
			template_name = "sponsor/mailattachment/list.html")),
			name="sponsormailattachment_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = SponsorMailAttachment,
			template_name= "sponsor/mailattachment/del.html",
			success_url="../list")),
			name="sponsormailattachment_del"),
]
Exemplo n.º 28
0
Arquivo: urls.py Projeto: OEHC/web
from django.conf.urls import patterns, url
from django.views.generic import DetailView, ListView, DeleteView
from django.core.urlresolvers import reverse_lazy
from ..tutor.auth import tutorbest_required
from .feed import NewsFeed
from .models import NewsPost
from .views import *

urlpatterns = patterns('',
    url(r'^(?:(?P<year>\d+)/(?:(?P<month>\d+)/(?:(?P<day>\d+)/(?:(?P<pk>\d+)/)?)?)?)?$',
        NewsView.as_view(), name='news'),
    url(r'^add/$', NewsCreateView.as_view(), name='news_add'),
    url(r'^edit/(?P<pk>\d+)/$', NewsUpdateView.as_view(), name='news_edit'),
    url(r'^delete/(?P<pk>\d+)/$',
        tutorbest_required(DeleteView.as_view(model=NewsPost, success_url=reverse_lazy('news'))),
        name='news_delete'),
    url(r'^feed/$', NewsFeed(), name='news_feed'),
)
Exemplo n.º 29
0
Arquivo: urls.py Projeto: zhwei/qipei
    #         ),
    #     name="update_product"
    # ),
    url(r'^update/(?P<product_id>\d+)$','views.update_product', name="update_product",),

    #### 删除多个model
    url(r'^delete/(?P<product_id>\d+)$','views.delete_product', name="delete_product",),


    ## 分类
    url(r'^sort/list$','views.show_sort',name="list_sort"),
    url(r'^sort/create/(?P<parent>\w+)/$','views.add_sort',name="create_sort"),
    url(r'^sort/delete/(?P<pk>\d+)/$',
        DeleteView.as_view(
            model=Sorts,
            context_object_name="foo",
            template_name="confirm_delete.html",
            success_url=reverse_lazy("list_sort"),
        ),
        name="delete_sort",
     ),


    ## 友情链接
    url(r'^links/list$',
        ListView.as_view(
            queryset=Links.objects.all(),
            context_object_name="links",
            template_name="list_link.html",
        ),
        name='list_link'
    ),
Exemplo n.º 30
0
        'django.contrib.auth.views.logout', {'next_page': '/food/'},
        name="logout"),
    url(r'^meals/$',
        ArchiveIndexView.as_view(model=Meal,
                                 date_field="date",
                                 allow_future=True),
        name="meal_archive"),
    url(r'^meals/(?P<year>\d{4})/$',
        YearArchiveView.as_view(model=Meal,
                                date_field="date",
                                allow_future=True,
                                make_object_list=True),
        name="meal_archive_year"),
    url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/$',
        MealMonthArchiveView.as_view(),
        name="meal_archive_month"),
    url(r'^meals/(?P<year>\d{4})/week(?P<week>\d{1,2})/$',
        MealWeekArchiveView.as_view(),
        name="meal_archive_week"),
    url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
        MealDayArchiveView.as_view(),
        name="meal_archive_day"),
    url(r'^meals/all/$', ListView.as_view(model=Meal), name="meal_list"),
    url(r'^meals/(?P<pk>\d+)/$',
        DetailView.as_view(model=Meal),
        name="meal_detail"),
    url(r'^meals/(?P<pk>\d+)/delete/$',
        DeleteView.as_view(model=Meal, success_url="/food/meals/"),
        name="meal_delete"),
)
Exemplo n.º 31
0
from django.shortcuts import render
from django.core.urlresolvers import reverse_lazy as r
from django.views.generic import CreateView, ListView, DetailView
from django.views.generic import UpdateView, DeleteView
from .mixins import NameSearchMixin
from .models import Person
from .forms import PersonForm


def home(request):
    return render(request, 'index.html')


class PersonList(NameSearchMixin, ListView):
    model = Person
    paginate_by = 5


person_detail = DetailView.as_view(model=Person)

person_create = CreateView.as_view(model=Person, form_class=PersonForm)

person_update = UpdateView.as_view(model=Person, form_class=PersonForm)

person_delete = DeleteView.as_view(model=Person, success_url=r('core:person_list'))
class PostCreateView(CreateView):
    model = Post
    form_class = PostForm
    template_name = 'meeting/add_post.html'

    def form_valid(self, form):
        posts = form.save(commit=False)
        posts.user = self.request.user
        posts.save()
        return super(PostCreateView, self).form_valid(form)



post_new = login_required(PostCreateView.as_view(model=Post, form_class=PostForm,template_name='meeting/add_post.html'))
post_edit = login_required(UpdateView.as_view(model=Post, form_class=PostForm,template_name = 'meeting/edit_post.html'))
post_delete = login_required(DeleteView.as_view(model=Post,success_url=reverse_lazy('meeting:post_list')))




class CommentCreateView(CreateView):
    model = Comment
    form_class = CommentForm
    template_name = 'meeting/add_comment.html'

    def form_valid(self, form):
        comment = form.save(commit=False)
        comment.post = get_object_or_404(Post, pk=self.kwargs['post_pk'])
        comment.comment_user = self.request.user
        comment.save()
        return super(CommentCreateView, self).form_valid(form)
Exemplo n.º 33
0
	url(r'^participants/revokeadmin/(?P<pk>[0-9]+)$',
		login_required(PermCheckPropertySetterView.as_view(
			model = DevroomParticipants,
			permission_checker = lambda obj, user: obj.project.has_write_permission(user),
			property_name = "isAdmin",
			property_value = False,
			redirect = lambda obj, kwargs: reverse("devroom_participants", kwargs = { "pk" : obj.project_id }) )),
		name="devroom_participants_revoke_admin"),
	url(r'^list/?',
		user_is_staff(ListView.as_view(
			queryset = Devroom.objects.select_related(),
			template_name = "devroom/list.html")),
			name="devroom_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = Devroom,
			template_name= "devroom/del.html",
			success_url="/devrooms/list")),
			name="devroom_del"),
	url(r'^export/adminmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.filter(Q(devroomparticipants__isAdmin=True,devroomparticipants__project__accepted=True) | Q(devrooms__accepted=True)).distinct(),
			template_name = "mail.html")),
			name="devroom_export_adminmail"),
	url(r'^export/allmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.filter(Q(devroomparticipants__project__accepted=True) | Q(devrooms__accepted=True)).distinct(),
			template_name = "mail.html")),
			name="devroom_export_allmail"),
	url(r'^export/xml',
		user_is_staff(XMLListView.as_view(
			queryset = Devroom.objects.select_related().filter(accepted=True),
Exemplo n.º 34
0
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView

from views import *
from forms import *
from models import *


urlpatterns = patterns(
    "hobetuz/",
    url(r"^list/$", login_required(RegistrationList.as_view()), name="hobetuz_list"),
    url(r"^new/$", RegistrationCreateView.as_view(), name="hobetuz_nueva"),
    url(r"^excel/$", RegistrationExcelView, name="hobetuz_excel"),
    url(r"^edit/(?P<pk>\d+)/$", login_required(RegistrationUpdateView.as_view()), name="hobetuz_edit"),
    url(
        r"^delete/(?P<pk>\d+)/$",
        login_required(DeleteView.as_view(model=Registration, success_url="/hobetuz/list/")),
        name="hobetuz_delete",
    ),
    url(r"^view/(?P<pk>\d+)/$", ver, name="hobetuz_view"),
    url(r"^print/(?P<pk>\d+)/$", imprimir_hobetuz, name="hobetuz_imprimir"),
    ## Genericas
    url(r"thanks/$", direct_to_template, {"template": "hobetuz/gracias.html"}, name="hobetuz_gracias"),
    # ~ ##Para los cursos
    url(r"^curso/list/$", login_required(CursoList.as_view()), name="hobetuz_curso_lista"),
    url(
        r"^curso/delete/(?P<pk>\d+)/$",
        login_required(DeleteView.as_view(model=Curso, success_url="/hobetuz/curso/list/")),
        name="hobetuz_curso_delete",
    ),
    url(
        r"^curso/new/$",
Exemplo n.º 35
0
    url(
        r'^(?P<slug>\S+)$',
        DetailView.as_view(
            model=Department,
            template_name='eggplant/departments/department_detail.html',
            context_object_name='department',
        ),
        name='detail'
    ),

    url(
        r'^(?P<slug>\S+)/update$',
        UpdateView.as_view(
            model=Department,
            template_name='eggplant/departments/department_form.html',
        ),
        name='update'
    ),

    url(
        r'^(?P<slug>\S+)/delete$',
        DeleteView.as_view(
            model=Department,
            template_name='eggplant/departments/department_delete.html',
            context_object_name='department',
        ),
        name='delete'
    ),
]
Exemplo n.º 36
0
		user_is_staff(CreateView.as_view(
			model = SponsorPackage,
			form_class = SponsorPackageForm,
			template_name = "sponsor/package/update.html",
			success_url = "%(id)s")),
		name = "sponsorpackage_new"),
	url(r'^(?P<pk>[0-9]+)$',
		user_is_staff(UpdateView.as_view(
			model = SponsorPackage,
			form_class = SponsorPackageForm,
			template_name = "sponsor/package/update.html",
			success_url = "list")),
		name = "sponsorpackage_update"),
	url(r'^list/?',
		user_is_staff(ListView.as_view(
			queryset = SponsorPackage.objects.all(),
			template_name = "sponsor/package/list.html")),
			name="sponsorpackage_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = SponsorPackage,
			template_name= "sponsor/package/del.html",
			success_url="../list")),
			name="sponsorpackage_del"),
	url(r'^export/xml',
		user_is_staff(XMLListView.as_view(
			queryset = SponsorPackage.objects.all(),
			template_name = "sponsor/package/xmlexport.html")),
			name="sponsorpackage_export_xml"),
)
Exemplo n.º 37
0
from django.core.urlresolvers import reverse_lazy
from django.views.generic import DetailView, CreateView, UpdateView, DeleteView
from blog.models import Post
from blog.forms import PostModelForm


# 기본 template_name : 모델명_detail.html
post_detail = DetailView.as_view(model=Post)

# 기본 template_name : 모델명_form.html
post_new = CreateView.as_view(model=Post, form_class=PostModelForm)

# 기본 template_name : 모델명_form.html
post_edit = UpdateView.as_view(model=Post, form_class=PostModelForm)

# 기본 template_name : 모델명_confirm_delete.html
post_delete = DeleteView.as_view(model=Post, success_url=reverse_lazy('blog:index'))
Exemplo n.º 38
0
	url(r'^(?P<pk>[0-9]+)$',
		user_is_staff(UpdateView.as_view(
			model = SponsorPackage,
			form_class = SponsorPackageForm,
			template_name = "sponsor/package/update.html",
			success_url = "list")),
		name = "sponsorpackage_update"),
	url(r'^list/?',
		user_is_staff(MultipleListView.as_view(
			template_name = "sponsor/package/list.html",
			template_params = {
				"object_list" : lambda req, kwargs : SponsorPackage.objects.filter(year=getActiveYear(req)),
				"importerForm" : lambda req, kwargs : PackagesImporterForm(),
				})),
			name="sponsorpackage_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = SponsorPackage,
			template_name= "sponsor/package/del.html",
			success_url="../list")),
			name="sponsorpackage_del"),
	url(r'^export/xml',
		user_is_staff(YSXMLListView.as_view(
			queryset = SponsorPackage.objects.all(),
			template_name = "sponsor/package/xmlexport.html")),
			name="sponsorpackage_export_xml"),
	url(r"^import$",
		user_is_staff(PackagesImporterView.as_view()),
			name="sponsorpackage_import"),
]
        posts = form.save(commit=False)
        posts.author = self.request.user
        posts.save()
        return super(PostCreateView, self).form_valid(form)


post_new = login_required(
    PostCreateView.as_view(model=Post,
                           form_class=PostForm,
                           template_name='bamboo/add_post.html'))
post_edit = login_required(
    UpdateView.as_view(model=Post,
                       form_class=PostForm,
                       template_name='bamboo/post_edit.html'))
post_delete = login_required(
    DeleteView.as_view(model=Post,
                       success_url=reverse_lazy('bamboo:post_list')))


class CommentCreateView(CreateView):
    model = Comment
    form_class = CommentForm
    template_name = 'bamboo/form2_add_comment.html'

    def form_valid(self, form):
        comment = form.save(commit=False)
        comment.post = get_object_or_404(Post, pk=self.kwargs['post_pk'])
        comment.author = self.request.user
        comment.save()
        return super(CommentCreateView, self).form_valid(form)

Exemplo n.º 40
0
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView, CreateView, ListView, DeleteView
from app.models import Article, Reporter

urlpatterns = [
    path('admin/', admin.site.urls),
    path('index/', TemplateView.as_view(template_name="index.html")),
    path(
        'addreporter/',
        CreateView.as_view(model=Reporter,
                           fields=('name', ),
                           template_name="addreporter.html",
                           success_url='/index/')),
    path(
        'addarticle/',
        CreateView.as_view(model=Article,
                           fields=('title', 'reporter'),
                           template_name="addatricle.html",
                           success_url='/index/')),
    path('viewreporter/',
         ListView.as_view(model=Reporter, template_name="viewreporter.html")),
    path('viewarticle/',
         ListView.as_view(model=Article, template_name="viewarticle.html")),
    path(
        'delete<str:pk>/',
        DeleteView.as_view(model=Reporter,
                           template_name="delete.html",
                           success_url='/viewreporter/'))
]
Exemplo n.º 41
0
from czat.models import Wiadomosc, Nieobecnosc
from django.views.generic import DeleteView
from django.contrib.auth.models import User
from django.urls import reverse

app_name = 'czat'  # przestrzeń nazw aplikacji
urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^user', views.UserList.as_view(paginate_by=5), name='users'),
    url(r'^edit/(?P<pk>\d+)/',
        login_required(views.EdytujUser.as_view()),
        name='edit'),
    url(r'^usunuser/(?P<pk>\d+)/',
        login_required(
            DeleteView.as_view(model=User,
                               template_name='czat/user_usun.html',
                               success_url='/users')),
        name='usunuser'),
    url(r'^rejestruj/',
        CreateView.as_view(template_name='czat/rejestruj.html',
                           form_class=UserCreationForm,
                           success_url='/'),
        name='rejestruj'),
    url(r'^loguj/',
        auth_views.login, {'template_name': 'czat/loguj.html'},
        name='loguj'),
    url(r'^wyloguj/',
        auth_views.logout, {'next_page': reverse_lazy('czat:index')},
        name='wyloguj'),
    url(r'^wiadomosci/',
        login_required(
Exemplo n.º 42
0
from django.views.generic import CreateView, UpdateView, DeleteView
from .models import Post

post_new = CreateView.as_view(model=Post)

post_edit = UpdateView.as_view(model=Post, fields='__all__', pk_url_kwarg='id')

post_delete = DeleteView.as_view(model=Post,
                                 success_url='/blog/',
                                 pk_url_kwarg='id')
Exemplo n.º 43
0
                    form_class=UserCreationForm,
                    success_url='/'), name='rejestruj'),
    url(r'^loguj/', 'django.contrib.auth.views.login',
                    {'template_name': 'czat/loguj.html'},
                    name='loguj'),
    url(r'^wyloguj/', 'django.contrib.auth.views.logout',
                    {'next_page': reverse_lazy('index')},
                    name='wyloguj'),
    url(r'^wiadomosci/', login_required(
                    ListView.as_view(
                        model=Wiadomosc,
                        context_object_name='wiadomosci',
                        paginate_by=10),
                    login_url='/loguj'),
                    name='wiadomosci'),
    url(r'^wiadomosc/$', login_required(
                    views.UtworzWiadomosc.as_view(),
                    login_url='/loguj'), name='wiadomosc'),
    url(r'^aktualizuj/(?P<pk>\d+)/', login_required(
                    views.AktualizujWiadomosc.as_view(),
                    login_url='/loguj'), name='aktualizuj'),
    url(r'^usun/(?P<pk>\d+)/', login_required(
                    DeleteView.as_view(
                    model=Wiadomosc,
                    template_name='czat/wiadomosc_usun.html',
                    success_url='/wiadomosci'),
                    login_url='/loguj'), name='usun'),

    url(r'^admin/', include(admin.site.urls)),
)
Exemplo n.º 44
0
# Django Imports
from django.conf.urls.defaults import *
from django.views.generic import DetailView, ListView, DeleteView
from django.contrib.auth.decorators import login_required

# Project Imports
from Django_Blog.blog.utils import reverse
from Django_Blog.blog.views import blog_editor, BlogIndex
from Django_Blog.blog.models import Entry
from Django_Blog.blog.feeds import LatestEntriesFeed

urlpatterns = patterns('',
    url(r'^$',BlogIndex.as_view(), name='blog_index'),
    url(r'^add/$', blog_editor, name='blog_add'),
    url(r'^view/(?P<slug>[-\w]+)/$', DetailView.as_view(
                                       model=Entry,
                                       template_name='blog/view.html'
                                ), name='blog_view'),
    url(r'^edit/(?P<slug>[-\w]+)/$', blog_editor, name='blog_edit'),
    url(r'^delete/(?P<slug>[-\w]+)/$', login_required(DeleteView.as_view(
                                         model=Entry,
                                         success_url=reverse('blog_index'))),
                                  name='blog_delete'),
    url(r'^latest/feed/$', LatestEntriesFeed()),
)
Exemplo n.º 45
0
			property_value = False,
			redirect = lambda obj, kwargs: reverse("exhibitor_participants", kwargs = { "pk" : obj.project_id }) )),
		name="exhibitor_participants_revoke_admin"),
	url(r'^list\+planning/?',
		user_is_staff(ListView.as_view(
			queryset = Exhibitor.objects.select_related(),
			template_name = "exhibitor/list+planning.html")),
			name="exhibitor_list_planning"),
	url(r'^list/?',
		user_is_staff(ListView.as_view(
			queryset = Exhibitor.objects.select_related(),
			template_name = "exhibitor/list.html")),
			name="exhibitor_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff(DeleteView.as_view(
			model = Exhibitor,
			template_name= "exhibitor/del.html",
			success_url="/exhibitors/list")),
			name="exhibitor_del"),
	url(r'^export/adminmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.filter(Q(exhibitorparticipants__isAdmin=True,exhibitorparticipants__project__accepted=True) | Q(exhibitors__accepted=True)).distinct(),
			template_name = "mail.html")),
			name="exhibitor_export_adminmail"),
	url(r'export/allmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.filter(Q(exhibitorparticipants__project__accepted=True) | Q(exhibitors__accepted=True)).distinct(),
			template_name = "mail.html")),
			name="exhibitor_export_allmail"),
	url(r'^export/xml',
		user_is_staff(XMLListView.as_view(
			queryset = Exhibitor.objects.select_related().filter(accepted=True),
Exemplo n.º 46
0
		user_is_staff(MultipleListView.as_view(
			template_name = "sponsor/sponsoring/list.html",
			template_params = {
				"object_list" : Sponsoring.objects.select_related(),
				"moneyRaised" : lambda req, kwargs : Sponsoring.objects.filter(commitment=True).aggregate(total_sum=Sum("package__price"))["total_sum"],
				"wantRecruiting" : lambda req, kwargs : Sponsoring.objects.filter(wantRecruting=True,commitment=True).count(),
				"noRecruiting" : lambda req, kwargs : Sponsoring.objects.filter(wantRecruting=False,commitment=True).count(),
				"canRecruiting" : lambda req, kwargs : Sponsoring.objects.filter(package__hasRecruitingEvent=True,commitment=True).count(),
				"wantBooth" : lambda req, kwargs : Sponsoring.objects.filter(wantBooth=True,commitment=True).count(),
				"noBooth" : lambda req, kwargs : Sponsoring.objects.filter(wantBooth=False,commitment=True).count(),
				"canBooth" : lambda req, kwargs : Sponsoring.objects.filter(package__hasBooth=True,commitment=True).count(),
				"offerForm" : lambda req, kwargs : OfferForm(),
			})),
			name="sponsor_list"),
	url(r'^del/(?P<pk>[0-9]+)$',
		user_is_staff( DeleteView.as_view(model = Sponsoring, template_name= "sponsor/sponsoring/del.html", success_url="/sponsors/list") ),name="sponsor_del"),
	url(r'^export/adminmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.annotate(num_spon=Count("sponsorings")).filter(num_spon__gt=0).distinct(),
			template_name = "mail.html")),
			name="sponsor_export_adminmail"),
	url(r'^export/allmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.annotate(num_spon=Count("sponsorings"), num_part=Count("sponsorparticipation")).filter( Q(num_part__gt=0)).distinct(),
			template_name = "mail.html")),
			name="sponsor_export_allmail"),
	url(r'^export/boothmail',
		user_is_staff(EmailOutputView.as_view(
			queryset = User.objects.filter(sponsorparticipation__package__hasBooth=True).distinct(),
			template_name = "mail.html")),
			name="sponsor_export_boothmail"),
Exemplo n.º 47
0
        r'^productcategories/$',
        login_required(
            ListView.as_view(
                model=ProductCategory,
                paginate_by=100,
            ))),
    url(
        r'^pc_create/$',
        login_required(
            CreateView.as_view(
                model=ProductCategory,
                success_url="/productcategories/",
                fields=("unique_name", "name", "desc", "image"),
            ))),
    url(
        r'^pc_update/(?P<pk>[0-9]+)/$',
        login_required(
            UpdateView.as_view(
                model=ProductCategory,
                success_url="/productcategories/",
                fields=("unique_name", "name", "desc", "image"),
            ))),
    url(
        r'^pc_delete/(?P<pk>[0-9]+)/$',
        login_required(
            DeleteView.as_view(
                model=ProductCategory,
                success_url="/productcategories/",
            ))),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 48
0
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from main.views import home_view, create_view
from django.views.generic import UpdateView, DeleteView
from main.models import Emp

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home_view, name='home'),
    path('home/', home_view, name='home'),
    path('create', create_view, name='create'),
    path(
        'update/<int:pk>',
        UpdateView.as_view(model=Emp,
                           fields="__all__",
                           success_url='/home/',
                           template_name='update.html')),
    path(
        'delete/<int:pk>',
        DeleteView.as_view(model=Emp,
                           success_url='/home/',
                           template_name='delete.html'))
]
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Exemplo n.º 49
0
# -*- coding: utf-8 -*-
# czat/urls.py

from django.conf.urls import url
from . import views  # import widoków aplikacji
from django.contrib.auth.forms import UserCreationForm
from django.views.generic.edit import CreateView
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.views.generic import ListView
from czat.models import Wiadomosc
from django.views.generic import DeleteView

app_name = 'czat'  # przestrzeń nazw aplikacji
urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^rejestracja/', CreateView.as_view(template_name='czat/rejestracja.html', form_class=UserCreationForm , success_url=reverse_lazy('czat:index'))),
    url(r'^logowanie/', auth_views.login, {'template_name': 'czat/logowanie.html'}, name='logowanie'),
    url(r'^wylogowanie/', auth_views.logout, {'next_page' : reverse_lazy('czat:index')}, name='wylogowanie' ),
    url(r'^wiadomosci/', login_required(ListView.as_view(model=Wiadomosc, context_object_name='wiadomosci', paginate_by=5)), name='wiadomosci'),
    url(r'^dodaj/$', login_required(views.DodajWiadomosc.as_view(),login_url='/logowanie'), name='dodaj'),
    url(r'^edytuj/(?P<pk>\d+)/', login_required( views.EdytujWiadomosc.as_view(), login_url='/logowanie'), name='edytuj'),
    url(r'^usun/(?P<pk>\d+)/', login_required( DeleteView.as_view(model=Wiadomosc, template_name='czat/wiadomosc_usun.html', success_url = '/wiadomosci'), login_url='/logowanie'), name='usun'),

]
Exemplo n.º 50
0
post_list =  PostListView.as_view()
'''
#prefetch 방법 1
post_list =  ListView.as_view(model=Post,
                              queryset=Post.objects.all().prefetch_related('tag_set','comment_set')
                              )
'''
#post_list =  ListView.as_view(model=Post, paginate_by =10)

post_detail = DetailView.as_view(model = Post)

'''
#blog/form.py  원래는 여기에다가 form 을 구현
class PostForm(forms.ModelForm):
    class Meta:
        model =Post
        fields = '__all__'

class PostCreateView(CreateView):
    model = Post
    form_class = PostForm 
    # success_url ='/..' 원래는 이 것을 구현해야한다. 그러나 get_absolute_url이 대신해주고 코드를 간편하게 해준다.

post_new = PostCreateView.as_view()
'''
post_new = CreateView.as_view(model =Post)
post_edit = UpdateView.as_view(model =Post, fields='__all__')

post_delete = DeleteView.as_view(model =Post, success_url= reverse_lazy('blog:post_list'))

Exemplo n.º 51
0
from django.conf.urls import patterns, url
from django.views.generic import DetailView, ListView, DeleteView
from django.core.urlresolvers import reverse_lazy
from ..tutor.auth import tutorbest_required
from .feed import NewsFeed
from .models import NewsPost
from .views import *

urlpatterns = patterns(
    '',
    url(r'^(?:(?P<year>\d+)/(?:(?P<month>\d+)/(?:(?P<day>\d+)/(?:(?P<pk>\d+)/)?)?)?)?$',
        NewsView.as_view(),
        name='news'),
    url(r'^add/$', NewsCreateView.as_view(), name='news_add'),
    url(r'^edit/(?P<pk>\d+)/$', NewsUpdateView.as_view(), name='news_edit'),
    url(r'^delete/(?P<pk>\d+)/$',
        tutorbest_required(
            DeleteView.as_view(model=NewsPost,
                               success_url=reverse_lazy('news'))),
        name='news_delete'),
    url(r'^feed/$', NewsFeed(), name='news_feed'),
)
Exemplo n.º 52
0
    url(r'^home/', home_view),
    url(r'^register/', register_view),
    url(r'^register/', register_view),
    url(r'^login/', login_view),
    url(r'^signout/', signout_view),
    url(
        r'^pgs/',
        ListView.as_view(
            model=PG,
            #template_name="pgmanager/",
            #queryset=PG.objects.all(),
            # fields=
        )),
    url(r'^pg_create/',
        CreateView.as_view(model=PG, fields="__all__", success_url='/pgs/')),
    url(r'^pg_update/(?P<pk>[0-9]+)',
        UpdateView.as_view(model=PG, fields="__all__", success_url='/pgs/')),
    url(r'^pg_delete/(?P<pk>[0-9]+)',
        DeleteView.as_view(model=PG, success_url='/pgs/')),
    url(
        r'^room_create/',
        CreateView.as_view(model=Room, fields="__all__",
                           success_url='/rooms/')),
    url(
        r'^room_update/(?P<pk>[0-9]+)',
        UpdateView.as_view(model=Room, fields="__all__",
                           success_url='/rooms/')),
    url(r'^room_delete/(?P<pk>[0-9]+)',
        DeleteView.as_view(model=Room, success_url='/rooms/')),
    url(r'^rooms/', ListView.as_view(model=Room)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 53
0
from django.shortcuts import get_object_or_404, resolve_url
from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView, UpdateView, DeleteView, CreateView

from blog.models import Post, Comment

index = ListView.as_view(model=Post,
                         template_name='blog/index.html',
                         paginate_by=1)

post_detail = DetailView.as_view(model=Post)

post_edit = UpdateView.as_view(model=Post, fields='__all__')

post_delete = DeleteView.as_view(model=Post, success_url=reverse_lazy('index'))

post_new = CreateView.as_view(model=Post, fields='__all__')


class CommentCreateView(CreateView):
    model = Comment
    fields = ['message']

    def form_valid(self, form):
        comment = form.save(commit=False)
        comment.post = get_object_or_404(Post, pk=self.kwargs['pk'])
        return super().form_valid(form)

    def get_success_url(self):
        return resolve_url(self.object.post)
Exemplo n.º 54
0
from django.views.generic import CreateView, ListView, DetailView, UpdateView, DeleteView
from .models import Assignment399
from django import forms
from django.urls import reverse_lazy

assignment399_list = ListView.as_view(model=Assignment399, paginate_by=5)

assignment399_delete = DeleteView.as_view(
    model=Assignment399,
    success_url=reverse_lazy('assignment399:assignment399_list'))


class AssignmentForm(forms.ModelForm):
    class Meta:
        model = Assignment399
        fields = '__all__'


class PostCreateView(CreateView):
    model = Assignment399
    form_class = AssignmentForm
Exemplo n.º 55
0
             fields="__all__",
             success_url="/submenus/",
         ))),
 re_path(
     "submenu_update/(?P<pk>[0-9]+)/",
     login_required(
         UpdateView.as_view(
             model=Submenu,
             fields="__all__",
             success_url="/submenus/",
         ))),
 re_path(
     "submenu_delete/(?P<pk>[0-9]+)/",
     login_required(
         DeleteView.as_view(
             model=Submenu,
             success_url="/submenus/",
         ))),
 path("menus/", menu_view),
 path(
     "menu_create/",
     login_required(
         CreateView.as_view(
             model=Menu,
             fields="__all__",
             success_url="/menus/",
         ))),
 re_path(
     "menu_update/(?P<pk>[0-9]+)/",
     login_required(
         UpdateView.as_view(
             model=Menu,
Exemplo n.º 56
0
            PropertySetterView.as_view(model=User,
                                       property_name="is_active",
                                       property_value=True,
                                       next_view="auth_user_list")),
        name="auth_user_enable"),
    url(r'^(?P<pk>\d+)/disable$',
        user_is_staff(
            PropertySetterView.as_view(model=User,
                                       property_name="is_active",
                                       property_value=False,
                                       next_view="auth_user_list")),
        name="auth_user_disable"),
    url(r'^(?P<pk>\d+)/delete$',
        user_is_staff(
            DeleteView.as_view(model=User,
                               template_name="registration/del.html",
                               success_url="/accounts/list")),
        name="auth_user_delete"),
    url(r'^(?P<pk>\d+)/removeToken$',
        user_is_staff(
            PropertySetterView.as_view(model=UserProfile,
                                       property_name="authToken",
                                       property_value=None,
                                       next_view="auth_user_list")),
        name="auth_user_remove_token"),
    url(r'^(?P<pk>\d+)/genAuthToken$',
        user_is_staff(GenerateAuthTokenView.as_view()),
        name="auth_user_gen_token"),
    url('^', include('django.contrib.auth.urls')),
]
Exemplo n.º 57
0
    path("", home_view, name='home'),
    path("register/", register_view, name='register'),
    path("login/", login_view, name='login'),
    path("logout/", logout_view, name='logout'),
    path('s_view', s_view, name='s_view'),
    path('department/', department_view, name='department'),
    path('student/', student_view, name='student'),
    re_path('s_update/(?P<pk>[0-9]+)', UpdateView.as_view(
        model= Students,
        fields="__all__",
        success_url= "s_view",
        template_name="students_update_form.html"
    )),
    re_path("s_delete/(?P<pk>[0-9]+)",DeleteView.as_view(
        model=Students,
        success_url="s_view",
        template_name="student_confirm_delete.html"
    )),
    path('d_list/', department_list, name='d_list'),
    re_path('d_update/(?P<pk>[0-9]+)', UpdateView.as_view(
        model=Department,
        fields="__all__",
        success_url="/d_list",
        template_name="department_update_form.html"
    )),
    re_path("d_delete/(?P<pk>[0-9]+)", DeleteView.as_view(
        model=Department,
        success_url="/d_list",
        template_name="department_confirm_delete.html"
    )),
]
Exemplo n.º 58
0
		user_is_staff(PropertySetterView.as_view(
			model = User,
			property_name = "is_active",
			property_value = True,
			next_view = "auth_user_list")),
		name = "auth_user_enable"),
	url(r'^(?P<pk>\d+)/disable$',
		user_is_staff(PropertySetterView.as_view(
			model = User,
			property_name = "is_active",
			property_value = False,
			next_view = "auth_user_list")),
		name = "auth_user_disable"),
	url(r'^(?P<pk>\d+)/delete$',
		user_is_staff(DeleteView.as_view(
			model = User,
			template_name = "registration/del.html",
			success_url = "/accounts/list")),
		name = "auth_user_delete"),
	url(r'^(?P<pk>\d+)/removeToken$',
		user_is_staff(PropertySetterView.as_view(
			model = UserProfile,
			property_name = "authToken",
			property_value = None,
			next_view = "auth_user_list")),
		name = "auth_user_remove_token"),
	url(r'^(?P<pk>\d+)/genAuthToken$',
		user_is_staff(GenerateAuthTokenView.as_view()),
		name = "auth_user_gen_token"),
	url('^', include('django.contrib.auth.urls')),
]
Exemplo n.º 59
0
from django.conf.urls import url
from django.views.generic import ListView, UpdateView, DeleteView, CreateView
from participant.models import Participant
from django.core.urlresolvers import reverse_lazy
urlpatterns = [
    url(r'^$', ListView.as_view(model=Participant, paginate_by=10), name='participant_list'),
    url(r'^pagina/(?P<page>[0-9]+)/$', ListView.as_view(model=Participant, paginate_by=10), name='participant_list'),
    url(r'^new$', CreateView.as_view(model=Participant, success_url=reverse_lazy('participant_list'),
                                     fields=['name', 'desc', 'contest', 'picture']), name='participant_new'),
    url(r'^edit/(?P<pk>\d+)$', UpdateView.as_view(model=Participant, success_url=reverse_lazy('participant_list'),
                                                  fields=['name', 'desc', 'contest', 'picture']),
        name='participant_edit'),

    url(r'^delete/(?P<pk>\d+)$', DeleteView.as_view(model=Participant, success_url=reverse_lazy('participant_list')),
                                                    name='participant_delete'),
]