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
1 answer

How to show a category list made by generic views in multiple pages?

I'm trying to build my own Blog app with Django 1.6. I've generated a category list by generic views like this: urls.py url(r'^categories/?$', views.ListView.as_view(model=Category), name='categories'), category_list.html

Categories

sheshkovsky
  • 1,302
  • 3
  • 18
  • 41
0
votes
1 answer

Django CSRF token missing or incorrect for FormView

I am new to Django and following this tutorial to add a Like button to a module. I have views like this: class VoteFormView(FormView): form_class = VoteForm def form_valid(self, form): pic = get_object_or_404(UserPic,…
hbp
  • 15
  • 4
0
votes
2 answers

django generic view update/create: update works but create raises IntegrityError

I'm using CreateView and UpdateView directely into urls.py of my application whose name is dydict. In the file forms.py I'm using ModelForm and I'm exluding a couple of fields from being shown, some of which should be set when either creating or…
smarber
  • 4,829
  • 7
  • 37
  • 78
0
votes
1 answer

Django login authentication not working

I am trying to use the generic login view provided by Django. i want the registration and login form on the same page. Here is my urls.py from django.conf.urls import patterns, include, url from myApp.forms import UsersForm urlpatterns =…
0
votes
2 answers

Django CreateView validate field not in fields

So, I have a Django generic view: class Foobaz(models.Model): name = models.CharField(max_length=140) organisation = models.ForeignKey(Organisation) class FoobazForm(forms.ModelForm): class Meta: model = Foobaz fields =…
jvc26
  • 6,363
  • 6
  • 46
  • 75
0
votes
0 answers

Django Month archive view date_list has incorrect dates

I am using django 1.5, python 3.3. The date_list in Month archive views is giving me incorrect dates. In the documentation: A DateQuerySet object containing all days that have objects available in the given month, according to queryset, represented…
John
  • 190
  • 1
  • 4
  • 15
0
votes
1 answer

django class-based views key word

I've been following the manual for generic views for Django 1.4, but can get the 'list books by publisher' example to work. My site is slightly different in that I'm trying to list bookings of a property by the name (or id) of the person who books…
sidestrand
  • 71
  • 12
0
votes
0 answers

url tag in generic views and noreversematch error

Following the cms project from "practical django project" i face an issue with the render functionality. In particular i have a view function called category_detail and i have a link reference in base.html which uses the url tag. this is Categories.…
b10n1k
  • 567
  • 5
  • 21
0
votes
1 answer

django urlconf cant find directives to including urls

i read the "practical django projects" and i stack on chapter 5. In general i have done exactly as it is in the book. I created a urls dir in coltrane app, I removed the urls.py file and i edited the urls.py in cms to write the include statements…
b10n1k
  • 567
  • 5
  • 21
0
votes
1 answer

url parameter for a generic view

I have a stupid problem about a wrong url... In the html menu: Update my profile In urls.py: urlpatterns = patterns('', (r'^update_profile', login_required(UpdateProfile.as_view())), ) In…
rom
  • 3,592
  • 7
  • 41
  • 71
0
votes
1 answer

Set date field reference to a field of a foreign key in Django

I have as follows: class FacturasMonthArchiveView(MonthArchiveView): queryset = Factura.objects.all() date_field = "pedido__fecha_pedido" make_object_list = True allow_future = True template_name = 'ventas/facturas.html' …
Enot
  • 790
  • 2
  • 15
  • 34
0
votes
2 answers

Using ClassBasedViews I want to retrieve records from my database in Django based on the user's email, which is stored in a session

For the past 2hrs i've been trying to accomplish the following in Django 1.5: I want to retrieve records from my database based on the user's email, which is stored in a session. Here are my ideal algorithms: In my function based view: 1. Attempt…
0
votes
1 answer

Loading some models in a generic view, breaking concepts?

First of all I'm a beginner in Django world so maybe what I'm trying to do is crazy or it's a misunderstanding of concepts, so here we go: How we can see, generic view save us a lot of time for that common patterns we use all the time in our…
Enot
  • 790
  • 2
  • 15
  • 34
0
votes
1 answer

Django class based generic views: setting a field to initial value based on context

I have a set of related models in a Django 1.5 app: Events that have EventSessions, and EventSessionRegistrations that belong to EventSessions. I'm struggling to create a class based generic view for a user-facing registration form, where a user…
Emil
  • 1,949
  • 2
  • 16
  • 25
0
votes
1 answer

Extended CreateView does not give the desired output in the template

I have two tables in my model.py: class Partner(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=255, blank=True) class Meta: db_table = 'partner' class Device(models.Model): id =…