I have a mini comunity where each user can search and find another user's profile.
Userprofile is a class model, indexed differently compared to user model class (user id is not equal to userprofile id).
But I cannot see a user profile by typing in the URL the corresponding id. I only see the profile of the currently logged in user.
Wh...
Hi,
in my Django (1.2) project, I want to prepopulate a field in a modelform, but my new value is ignored.
This is the snippet:
class ArtefactForm(ModelForm):
material = CharField(widget=AutoCompleteWidget('material', force_selection=False))
def __init__(self, *args, **kwargs):
super(ArtefactForm, self).__init__(*args,...
What is better for web development Python+Django or PHP+Symfony ?
And why?
...
The urlconf and view is as follows:
url(r'^register/$',
register,
{ 'backend': 'registration.backends.default.DefaultBackend' },
name='registration_register'),
def register(request, backend, success_url=None, form_class=None,
...
Hi there,
I'm wondering which authentication method to use if i need extended permissions (e.g. if i want to use the users photos in my application). The methods are either the single-sign on using JavaScript SDK or by using the OAuth 2.0 protocol. Both methods are explained here: Authentication - Facebook developers. The JS SDK would b...
Hello!
To empty database table, I use this SQL Query:
TRUNCATE TABLE `books`
How to I Truncate table using Django models and orm?
I've tried this, but it doesn't work:
Book.objects.truncate()
...
I am new to ajax and using Django for web development.
Now My Template contains : sample.html
<html>
<body>
<script language="javascript" type="text/javascript">
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safar...
I am using Django and Postgresql as my DBMS.
I wish to set a setting that enables to enable/disable database connection. When the connection is set to closed (in settings.py) the site will display a message such as "meintanence mode" or something like that. Django will not show any db connection error message (or mail them to admins). I...
hello,
i have a method where i am saving the data from users, but each user has to have a single profile, so each time he saves, the data should be overwritten.
first i verify if he already has a profile data, and in this case i add an instance to the form. if not, (this is his first registration), i simply add data into DB
my code is:
...
I initially wrote code to build a form dynamically, based on data from the DB, similar to what I described in my previous SO post.
As SO user Daniel Roseman points out, he would use a formset for this, and now I've come to the realization that he must be completely right. :)
My approach works, basically, but I can't seem to get valida...
I have just upgraded to Django 1.2 and I am trying to run my project. After I login I get
Forbidden (403)
CSRF verification failed. Request aborted.
which is strange because I haven't enabled CSRF protection previously. Do I have to configure something else to have my project work?
...
I am building a django based application and its time to add the DHTML stuff.
One of my fields represent a database field with this format databaseName.tableName.fieldName
I would like to have javascript autocompletion in three levels, say once I type part of the database names I get a list of all matching databases, one that is select...
I want to have a view in my app that allows the user to remove one of many filters from the GET list, then redirect using the remaining variables in the list. How can I achieve this? Possibly having one filter-remove view that works for all the variables the user can set in the filter.
...
Hi folks,
I'm trying to find a way to filter down rows of objects within Django Admin, using a queryset.
e.g. Person.objects.filter(Q(name='John')|Q(surname='Doe'))
I'm finding quite complicated to figure out.
Any ideas?
...
I have a form like this:
CHOICES = [
('a', 'a_value'),
('b', 'b_value'),
('c', 'c_value')
]
self.fields["choice"] = forms.ChoiceField(
widget=RadioSelect(),
choices=CHOICES,
)
How can I select a single element of this form field in my template? I want to be able to do somet...
Hi,
I want to use annotate to count the number of occurances in my model, however it is not using the right field in the group by statment. instead of using the field i want (i.e. the one specified in the count function) it uses the primary key of the model. e.g.
ObjectHistory.objects.annotate(revisions=Count('resource'))
produces s...
going through both the django book and tutorial, am a bit confused to the differences in approach (aren't they both written by the same people?)
can anyone who has experience in both give a short review on them? i have decent python skills (largely untested though), but no experience at all in web apps and am trying to decide which one...
Hi all,
I have a database of articles with a
submitter = models.ForeignKey(User, editable=False)
Where User is imported as follows:
from django.contrib.auth.models import User.
I would like to auto insert the current active user to the submitter field when a particular user submits the article.
Anyone have any suggestions?
...
Hi, I'm new to Django. I am writing my own administrative action for a third party app/model, similar to this: http://mnjournal.com/post/2009/jul/10/adding-django-admin-actions-contrib-apps/
It's a simple snippet of code. I'm just wondering where people suggest that I put it. I don't want to put in the third party app because I might ne...
This seems so basic - I must be missing something.
I am trying to download my entities, update a few properties, and upload the entities. I'm using the Django nonrel & appengine projects, so all the entities are stored as id rather than name.
I can download the entities to csv fine, but when I upload (via appcfg.py upload_data ...), t...