Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

Django foreign key is not set and hence unable to save form

I have a simple foreign key relationship between two tables. I am able to save the parent, but am unable to save the child which has a foreign key to the parent. This is what my models look like: ...
tks's user avatar
  • 55
1 vote
0 answers
114 views

Programmatically set the model on a class based view in Django 1.3

I'm trying to implement a more generic version of the Django class based detail view, which can operate on different models when required. The idea was to set the model using a parameter in the URL, ...
Jharwood's user avatar
  • 1,056
0 votes
2 answers
150 views

Django: using {{STATIC_URL}} from python side

Building a "history" system that serves static pages based on the date the user asks for. Not all dates have associated pages, and it isn't possible to know, based on what's in the database which do, ...
griswolf's user avatar
0 votes
1 answer
488 views

Update a count variable in model object

What I want to do is simple I want to update the count variable of the object every time my view function is called. My models is like this: class Url(models.Model): #some vars here ...
Dhiraj Thakur's user avatar
2 votes
1 answer
2k views

Function-based generic views have been deprecated

DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead. I keep getting this warning, when I'm running my site. What does this mean and how can I fix it?
anc1revv's user avatar
  • 1,613
1 vote
1 answer
1k views

django-userena views.py and user registration issues

django-userena does not have a views.py file. It uses instead html files, i would like to use this views.py instead of the html files, because i want to add some other features, like a file uploader. ...
user's user avatar
  • 973
0 votes
1 answer
3k views

Django redirecting to another view with a bound form

I am using Python 2.7, Django 1.3.1. I am trying to implement a sign in functionality that can be called from arbitrary page and redirects to the same page without any code duplication. The current ...
saurabh's user avatar
  • 137
1 vote
1 answer
2k views

display json dictionary values in templates

I am doing ajax using jquery in django1.3,well its works fine. Am using jquery load method to fill a in a template. I get a json object asychrosily when user cliks in a button.I pass it to another ...
Jisson's user avatar
  • 3,705
0 votes
1 answer
458 views

django1.3 static file problem

hi, I am new to django,I doing user authentication for my project,Well its works properly. I have created a folder named 'static' in my projects root folder[now am in local devlopment] and necessary ...
Jisson's user avatar
  • 3,705
0 votes
3 answers
210 views

django foreign key complex query

I know this is dumb but... I have two model classes class Gallery(models.Model): name = models.CharField(max_length=200) pub_date = models.DateTimeField('date published', auto_now_add=True) ...
themunna's user avatar
3 votes
3 answers
4k views

Django 1.3 CreateView/ModelForm: unique_together validation with one field excluded from form

I am looking for a simple answer by example to this common problem. The answers I found so far leave out critical points for us beginners. I have an app where almost every model has a ForeignKey to ...
user avatar
3 votes
1 answer
3k views

Django 1.3 CreateView, ModelForm and filtering fields by request.user

I am trying to filter a field on a ModelForm. I am subclassing the generic CreateView for my view. I found many references to my problem on the web, but the solutions do not seem to work (for me at ...
user avatar
6 votes
1 answer
4k views

Class based view extending UpdateView not saving form correctly

Im trying to save a form using UpdateView in Django 1.3 and seemed to have run into a problem. When I am saving the form, it POST's to the current URL and the success url is the same url. When saving ...
Omar Estrella's user avatar
3 votes
2 answers
5k views

Django get() takes exactly 2 arguments (3 given)

I am trying to use DetailView generic class in my test app and this is what I have in my view *updated model * from this example class AuthorDetailView(DetailView): context_object_name = "...
iJK's user avatar
  • 4,745
9 votes
2 answers
4k views

How to specify something other than pk or slug for DetailView

I was wondering if it was possible to use something besides a pk or slug when you are using a DetailView in Django 1.3. For example, I currently have: url(r'^mymodel/(?P<pk>\d+)/$', ...
Omar Estrella's user avatar