Django is an open source Web 2.0 application framework, written in Python. Its primary goal is to ease the creation of complex database-driven websites.
0
votes
0answers
3 views
Django. How to expire all user passwords?
I have a site with a few thousands registered users. In the unfortunate event when someone steals passwords from my database, I would like to have a plan A and a plan B. I guess plan B would be to ...
0
votes
1answer
10 views
How to use one table id in another table
I am working with django and mysql database. I want to use an id from my table called 'question' and want to use it in my 'answer' table.I want that the id in the 'answer' table should be same as the ...
0
votes
1answer
21 views
Rendering requests with Django
I have written a method in my views.py in such a way that I'm showing a form for a GET request (formExample1.html), and after submiting the form with a POST and doing some stuff, I'm showing a results ...
0
votes
2answers
13 views
null=True in model not accepting null values
views.py
report = Report.objects.get(user=user.id)
reportnotesform=ReportNotes(instance=report)
if request.method == 'POST':
locationnotesform=LocationNotes(request.POST,instance=report)
if ...
0
votes
1answer
7 views
HTML&Django-why still get error message for null input for class field models.DateField(null=True)?
I have a date data type in one of my class and it is optional, so I set null=True. but when the user input nothing for the date and submit the info, I get the error message of
[u"'' value has an ...
0
votes
3answers
16 views
Form can't find save method
I've a problem and I don't know where it comes from.
I've this form :
class LinkWidgetToDashboardForm(forms.Form):
widget = forms.MultipleChoiceField(
choices = [(w.pk, w.name) ...
0
votes
1answer
12 views
BooleanField default value not set when creating a model instance
When creating an instance of a model having a BooleanField my_boolean_field with a default set to True, I get an error:
my_boolean_field is required
Shouldn't it be set to the default value?
...
0
votes
0answers
39 views
set default location as current location in javascript
JS:
var geocoder = new google.maps.Geocoder();
function geocodePosition(pos) {
geocoder.geocode({
latLng: pos
}, function(responses) {
if (responses && responses.length > ...
0
votes
1answer
32 views
How to do sorting in template in Django?
I am listing all the file information in tabular form like this in Django:
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
<tr>
<th ...
1
vote
0answers
18 views
showing child model data in search haystack
I am using haystack-solr for search and what i want to do is when a person search on education it shows all data of user which is a foreign key
my models:
class user_info(models.Model):
gender= ...
1
vote
1answer
18 views
How to set csrf token cookie when a view return a json data?
Here is my signup view, and I use ajax to post.
I have followed the official document. If the csrftoken cookie exists, it works fine.
However, the view returning json data didn't set the csrftoken. ...
-1
votes
0answers
19 views
Python Django objects with default
Is there a way to display a default value in a model object? like Person.objects.all().default(name=value) sort of this? I'm using a select in my template as a dropdown. Please.
Thanks in advance.
0
votes
2answers
18 views
date validation giving error “strftime' is not defined”
I am trying to validate date with two different input form.I don't know i ma doing wrong.
forms.py
class ReportForm(forms.ModelForm):
manual_date = ...
0
votes
1answer
12 views
How to use Q objects to check if any members of arbitrary-length list are in Many-To-Many Relationship
Suppose I have the following Django models:
class myObj1(models.Model):
myField1 = models.IntegerField()
class myObj2(models.Model):
myLocalObj1 = models.ManyToManyField(myObj1)
...
0
votes
2answers
29 views
How do I access a value from a foreign key in Django template
I have read all the related threads and have exhausted my research and nothing I do seems to work. I'll include the relevant code:
models.py
class Blog(models.Model):
title = ...