django-generic-views Questions
3
Solved
I use Django's built-in DeleteView and I've assigned a value to the success_url attribute. Now in my template, I trigger this view via JQuery' $.post() method. When the item is deleted, I don't get...
Jarred asked 19/3, 2015 at 5:39
1
I tried a minimalistic django implementation of generic views to upload profile pictures.
views.py
class UpdateProfile(UpdateView):
form_class = UpdateUserProfileForm
model = UserProfile
succe...
Impetrate asked 5/10, 2016 at 15:8
2
I have a model "SavedSearch" with a generic UpdateView. Each site user can have one Saved Search. When running a search on the site, I want to give them the ability to click a "Save this Search" bu...
Machination asked 16/12, 2014 at 7:34
1
Solved
I am trying to create a list_view for a model queryset. When running my server, it returns : attribute error - 'function' object has no attribute 'as_view'. I would appreciate helping me in solve t...
Fasten asked 2/8, 2016 at 15:16
1
Solved
I have a simple model with a generic foreign key:
class Generic(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericFo...
Emancipated asked 26/1, 2016 at 15:39
3
Solved
So I have a model that includes:
class Place(models.Model):
....
created_by = models.ForeignKey(User)
My view is like so:
class PlaceFormView(CreateView):
form_class = PlaceForm
@method_de...
Execrable asked 26/4, 2011 at 3:53
1
Solved
I'm building Django application, with submitting links and voting functionality.
I want to show all links, voted by a user in user details page. I can retrieve them in python shell using this:
Li...
Invalidity asked 4/10, 2015 at 9:38
1
Solved
I'm tryinig to get haystack working with a class-based generic view according to the documentation here. I can get results from a SearchQuerySet in the shell, so the models are being indexed. But I...
Tilt asked 29/9, 2015 at 10:51
2
Solved
I am currently using django's CreateView to post data to the database. Unfortunately, the method where I would like to save and perform custom logic, form_valid() is never called. I read on another...
Yolandayolande asked 28/7, 2015 at 3:48
2
Solved
I have a model with a ManyToMany relation that I would like to update with a CheckBoxSelectMultiple widget while everything else uses the default generic form, but when I redefine that one form fie...
Neale asked 5/6, 2013 at 10:5
4
Solved
I am using django generic views, how do I get access to the request in my template.
URLs:
file_objects = {
'queryset' : File.objects.filter(is_good=True),
}
urlpatterns = patterns('',
(r'^files...
Porphyroid asked 31/8, 2010 at 8:25
2
Solved
I'm sharing the same template for my CreateView and UpdateView using django's generic views. I want the "submit" button in my template to say "Add" when I'm using the CreateView and "Update" when I...
Beset asked 11/6, 2014 at 20:47
2
Solved
I'm at the last part of this tutorial.
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView
from polls.models import Poll
urlpatterns = patter...
Hart asked 6/9, 2012 at 16:3
1
Solved
Django IntegrityError at /new null value in column "owner_id" violates not-null constraint
I'm trying to track the user that created an object using a CreateView and I'm doing it exactly like it's done in documentation (https://docs.djangoproject.com/en/dev/topics/class-based-views/gener...
Parthia asked 3/3, 2014 at 19:16
2
Solved
I am trying to implement role based permission into my application. I have a decorator role_required into which I can pass a set of user roles and only those user with that role can access that vie...
Sorb asked 22/6, 2012 at 5:12
1
Solved
I created a class that inherits from DetailView, and I overrided the methods get_context_data and post. What it seems weird as mentioned in the title, is that I can call self.object from get_contex...
Hotpress asked 5/10, 2013 at 11:50
1
I was having trouble with FormView recently and found that the way to go about doing it was to use get_form_kwargs.
Here is my code:
class InternalResetPasswordView(FormView):
template_name = 'r...
Dismuke asked 4/9, 2013 at 3:39
1
Solved
Let's say we have an app called Closet and it has some models:
# closet.models.py
class Outfit(models.Model):
shirt = models.ForeignKey(Shirt)
pants = models.ForeignKey(Trouser)
class Shirt(mod...
Beichner asked 19/6, 2013 at 12:56
2
Solved
I'm trying to write a test that validates HTML returned from a generic class-based view. Let's say I have this function-based view that simply renders a template:
# views.py
from django.shortcuts ...
Thebaid asked 21/4, 2013 at 16:4
2
Solved
I'm diving into Django's generic views, figuring out how they return a simple HttpResponse object, like a simple view function would.
I have written a simple project for testing, and I added some l...
Quezada asked 24/2, 2013 at 19:47
2
Solved
I used Django's generic createview for my model
from myproject.app.forms import PersonForm
class PersonMixin(object):
model = Person
form_class = PersontForm
class PersonCreateView(PersonMixin,...
Eliezer asked 1/11, 2012 at 15:17
4
Solved
I'm fairly new to python and following along with part 4 of the tutorial for the Django framework here. I'm trying to implement generic views for the polls app--my code seems correct (as far as I c...
Improbity asked 30/7, 2009 at 2:24
1
Let's say I have a model like this:
class Car(models.Model):
BRANDS = (
('FRD', 'Ford'),
('MCD', 'Mercedes'),
...
)
brand = models.CharField(max_length=3, choices=BRANDS)
color = models.Cha...
Complicity asked 5/8, 2012 at 20:16
1
Solved
I'm pretty new at Django and wondering what is the difference between defining model vs queryset in a generic view like ListView. Here's my code example in my urls.py file for the project:
urlpatt...
Metabolize asked 8/7, 2012 at 19:24
2
Solved
What I'm trying to do is Django boilerplate for functional views. Any help here is very much appreciated, as the docs show examples for the template view and list view, but I've found very little f...
Anabelle asked 9/4, 2011 at 19:10
© 2022 - 2024 — McMap. All rights reserved.