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
0 answers

Django Rest Framework Generic Relation to search by risk tag

Here are the models I created: So I have labelled each data item (search result) with risk and now I would like to browse data item by risk within a project. I don't have concrete idea how generic relation works. Looking up on forums I saw people…
0
votes
2 answers

object_detail() got multiple values for keyword argument 'queryset' while inputting only one

from django.conf.urls.defaults import * from django.conf import settings from Website.Blog.models import Post # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() index = { …
the_drow
  • 18,571
  • 25
  • 126
  • 193
0
votes
1 answer

How to avoid duplicating multiple views for similar models in Django?

I have a model called Link which allows users to send url's. And there are some Generic Views to handle CRUD operations. Then I've decided to add another model called Image which allows users to send images. Since there are multiple shared field…
sheshkovsky
  • 1,302
  • 3
  • 18
  • 41
0
votes
0 answers

django update/create view old values

i have a ModelForm that i use as the form_class for both of the views. in both cases i need to update a different model before i save the object of the views. i.e. i use the views to create/update model A and i need to update model B based on the A…
brad
  • 491
  • 1
  • 9
  • 24
0
votes
1 answer

How to write a revision for Gerenic DeleteView visible in the admin (Django Reversion)?

I can view all deleted objects when I delete an object in the Django Admin with Reversion installed. But I can't see the deleted object when I delete it in my self-written (gerenic) view. (I'm using the context manager. I can see the changes in the…
yofee
  • 1,287
  • 12
  • 25
0
votes
1 answer

Django : Filter, limit and display file filed dynamicly with generic inlineformset

I need your help, because I'm stuck in a project with no idea about how to continue. I need to implement a simple "generic" document management app to integrate it in my project. I can have many kind of documents that are defined by…
0
votes
1 answer

how generic view works in django?

I want to using generic classes for my blog. Everything is fine and I know how it works and I like the idea behind it. But I see a generic class just grabs one or few blog posts and sends them to template. Is it possible to add more data to template…
Naser Hamidi
  • 176
  • 1
  • 11
0
votes
1 answer

Template not loaded in Generic Formview used in Mezzanine project

I want to add a contact form in my homepage in a mezzanine project. Homepage inherits from Page class and is loaded perfectly using the mezzanine project. I created a new generic view in my project and I bound urls.py to it. class Home(FormView): …
Emilio Conte
  • 1,105
  • 10
  • 29
0
votes
2 answers

Duplicated queries in CreateView

I have a CreateView with two queryset related, but in order my class works I repeated these queries. I tried this: class CrearEvidencia(CreateView): from django.shortcuts import get_object_or_404, get_list_or_404 from core.models import…
toledano
  • 289
  • 11
  • 20
0
votes
1 answer

Django CreateView does not save object

I'm trying to use a Create View class in a Django App, but can't save the object. I tried some suggestions posted in related questions here and here with no results. The error is NoReverseMatch at /metas/add-meta Reverse for 'metas_detalle'…
toledano
  • 289
  • 11
  • 20
0
votes
1 answer

troubles with dynamic filtering in generic-display Django

I am trying to display a list of the users. once you select the user you can view the userprofile. the thing is: UserProfile does not work. how to make it works? #views.py class UserList(ListView): model = Userx template_name…
john
  • 25
  • 6
0
votes
1 answer

Math in Django to get a total returned

I'm trying to get to a result that tells me something like 10.5 hours worked on a project. here's what I'm doing in my view: time = Time.objects.filter(my_company=my_company, project=project) raw_hours = time.aggregate(Sum('hours')) raw_minutes =…
Dave Merwin
  • 1,382
  • 2
  • 22
  • 44
0
votes
2 answers

Django Class Based Views: Understanding the arguments in the view class

Reading through the source code for View Class Source code: class View(object): """ Intentionally simple parent class for all views. Only implements dispatch-by-method and simple sanity checking. """ http_method_names = ['get', 'post', 'put',…
0
votes
1 answer

Dynamically Changing a ListView (by day)

I have a ListView (generic CBV) of events. This ListView should dynamically update each day, so that "old" events (i.e. events that have already happened) are excluded from the context when a user visits the page. I just noticed that this page is…
rnevius
  • 26,578
  • 10
  • 58
  • 86
0
votes
1 answer

UpdateView clean deleted form but does not actually delete it

I have formset of modelforms contains ImageField. After click on delete checkbox near initial form, and submit button - I have same number of forms in formset, and same number of initial forms, but those which have been "deleted" now are without…
madzohan
  • 11,488
  • 9
  • 40
  • 67