Questions tagged [django-generic-views]

Questions about Django’s built-in generic views, which helps you to avoid repeating common code patterns in every project.

Questions about Django’s built-in generic views, which helps you to avoid repeating common code patterns in every project.

568 questions
0
votes
2 answers

Django Generic Views Date-Based URLconf

Trying to teach myself Django but running into a snag. Generic Views seem to be a great idea but I personally find the documentation a little cryptic at times (maybe I'm being prissy). So I have been trying to use the Date Based generics views in…
RomaH
  • 241
  • 1
  • 2
  • 8
0
votes
2 answers

Correct Django template url variable to use with the Generic View list_detail

For whatever reason I'm having a tough time figuring out the correct variable to use in my url template tag to properly render my template. #firms/url.py from django.views.generic import list_detail firm_list = { 'queryset' :…
harristrader
  • 1,181
  • 2
  • 13
  • 20
0
votes
1 answer

Is Django's update_object generic view secure? Should I extend it or make my own for security?

I'm new to Django. Last night I worked hard on a view that would allow me to edit any of the entities in my current project; Chapters, Stories, and Worlds. In order to ensure that I know precisely which database object is being modified, I added a…
Paragon
  • 2,692
  • 3
  • 20
  • 27
0
votes
1 answer

Generic view inheritance in Django

The question is how to pass kwargs from URL to the parent class view? urls.py urlpatterns = patterns('', url(r'^(?P\d+)/(?P\d+)/scout/$', login_required(ScoutView.as_view()), name="scout"), ) views.py Look at first class __init__…
aemdy
  • 3,702
  • 6
  • 34
  • 49
-1
votes
1 answer

How implement django.views.generic for logoutPage/loginPage if earlier used request?

What is the best practice for migration from request to django.views.generic? How implement django.views.generic for logoutPage/loginPage if earlier used request? #This my model.py from django.db import models from django.contrib.auth.models import…
-1
votes
1 answer

Django Generic Based view: not saving HTML form data to database

I have a Django library application with several books and authors, here is a /author/create html form used by the admin to create/update details of the author (firstname, lastname, dob, profile picture), referring the MDN Library application. I…
Simran
  • 593
  • 1
  • 14
  • 37
-1
votes
1 answer

How do I access own parameters in class based views - Django

I have this url: url(r'^ceniky-edit/kadernictvi/$', views.CenikView.as_view(typ='kadernictvi'), name='ceniky-edit-kadernictvi'), and I want to get value of "typ" in my view, how I can do that ? Thank you guys.
-1
votes
1 answer

Django - Generic detail_view doesn't accept an object_list

I have the following in urls.py: url(r'frameworkslist/(?P\d+)$', DetailView.as_view(queryset=Category.objects.all().order_by("id"), template_name='home/subcategory.html')) And in my html template: {% extends "Layout.html" %} {% block content…
-1
votes
1 answer

Django DetailView occurs an error?

I Implemented very simple DetailView in Django 1.9.5: class PostDetailView(DetailView): Model = Post template_name = "post/detail.html" urls.py from django.conf.urls import url from chacha_dabang.views import * urlpatterns = [ …
user3595632
  • 5,380
  • 10
  • 55
  • 111
-1
votes
1 answer

DeleteView doesn't delete and just refreshes the delete page

When I click on my delete project link it takes me to my delete page with a button to click which should delete the model data of the project and then take me to the profile page. However when I click the delete button, the page just refreshes and…
-2
votes
1 answer

How we can create generic API in django?

I'm totally new to Django. I'm creating Generic API. List and Create are working well but ID is not visible in DELETE and UPDATE. This is my views.py file from rest_framework import generics from rest_framework import mixins This is my urls.py…
-2
votes
1 answer

what is super in this in this method?

class PublisherDetail(DetailView): model = Publisher def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super().get_context_data(**kwargs) # Add in a QuerySet of…
-2
votes
1 answer

Django generic views - sending data to project templates

i try to send data with generic views from my app urlpatterns = patterns('', (r'*', ListView.as_view( queryset=Post.objects.all().order_by("-created")[:2], template_name="/mysite/templates/index.html" )), ) however, data cannot…
user1407540
  • 101
  • 2
  • 3
  • 10
1 2 3
37
38