Hello, I am planning on writing a medium size web application that will be XML heavy. I will need to do heavy xml processing. When a user requests a webpage the program will fetch the XML from the database then it will process the XML then render the results to the browser. The XML is not big but i will need to make changes to the xml ru...
models.py:
class root(models.Model):
uid_string = models.CharField(max_length=255, unique=True)
class tree(models.Model):
uid_string = models.ForeignKey(root, to_field='uid_string', db_column='uid_string')
class shrub(models.Model):
uid_string = models.ForeignKey(root, to_field='uid_string')
obviously, the column ...
I want to delete a record. But I of a particular record. Such as
delete from table_name where id = 1;
How can I do this in a django model?
I am writing a function:
def delete(id):`
-----------
...
Hi
I am using python and django and like it a lot. But than i use it, I catch myself thinking
what i do a lot of work to render result data and write specific actions for it. For example than i pass result set of objects to template
i must render all data and write all possible actions such as sorting by columns,filtering,deletion,edit ...
Hallo Folks,
I hope you can help me with a little problem I came in touch with while building a model with a foreign key to itself.
Here an example:
class Example (model.Model):
parent = models.ForeignKey('self', null=True, blank=True)
# and some other fields
After creating a new entry in the admin panel and going into this ...
I am using Django and am making some long running processes that I am just interacting with through my web user interface. Such as, they would be running all the time, checking a database value every few minutes and stopping only if this has changed (would be boolean true false). So, I want to be able to use Django to interact with thes...
python manage.py dumpdata modelName > file.json.
created an empty database for a user meder on postgres
modified pga_hb.conf so that meder can use the database
changed the settings in settings.py
python manage.py syncdb ( I didnt create a su )
attempting to loaddata file.json but it complains that the superuser isn't there or doesn't m...
I am getting a TemplateSyntaxError, that is only happening on my dev server, but works fine on the django testing server locally.
Here's the error
Caught SyntaxError while rendering: invalid syntax (urls.py, line 1)
and the html:
<li><a href="{% url plan.views.profile %}">Plan Details</a></li>
and here is the profile view:
@login...
Hey there,
Now im working this base on dmitko tutorial on extending django-registration post, all went out fine, just the i can't received the user_registered signal properly.
forms.py
from django import forms
from registration.forms import RegistrationForm
from models import UserProfile
class UserProfileForm(RegistrationForm):
fu...
I have a Django app where there are 2 use cases where I want a user to be able to login without a password.
User registers and gets activation link in e-mail.
User resets password and gets link to change password form in e-mail.
The links include a one-time-use key that I validate, and then I want to log the user in without using cre...
I have an Apache2 + mod_python setup which has begun responding impossibly slow since some days - two seconds of processor time for any request of my app.
Some interesting points:
Debugbar says it's ~15ms of query time. DB is not the main suspect
Logging with datetime.now() shows 0.1s is spent inside the view, and 40ms more are spent i...
I have two models like so:
class ObjectLock(models.Model):
partner = models.ForeignKey(Partner)
object_id = models.CharField(max_length=100)
class Meta:
unique_together = (('partner', 'object_id'),)
class ObjectImportQueue(models.Model):
partner = models.ForeignKey(Partner)
object_id = models.CharField(max_...
Docs say :
``success_url``
The name of a URL pattern to redirect to on successful
acivation. This is optional; if not specified, this will be
obtained by calling the backend's
``post_activation_redirect()`` method.
How can I do it ?
...
After finishing the core functionalities of my project it's time to begin with other secundary but important things.
I've something like the following models.py file:
class Category(models.Model):
name = models.CharField(max_length=30)
class Transaction(models.Model):
name = models.CharField(max_length=30)
description =...
I used the following commands to generate 2 fixtures:
./manage.py dumpdata --format=json --indent=4 --natural auth.User > fixtures/user.json
./manage.py dumpdata --format=json --indent=4 --natural --exclude=contenttypes --exclude=auth > fixtures/full.json
I've got the following fixture named user.json:
[
{
"pk": 4,
...
Is django-threadedcomments 0.52 supported by django 1.2?
...
I have a date_added field for my entries and it's frustrating clicking the date and time when filling these in. I want this to happen behind the scenes and I don't want these to even show up.
I've googled around and tried searching SO but was unable to find a snippet of how this can be done when I save my form.
Here's the relevant bit ...
So. The following isn't very 'smart' ;)
MONTHS = (
('Jan', 'Jan'),
('Feb', 'Feb'),
('Mar', 'Mar'),
('Apr', 'Apr'),
('May', 'May'),
('Jun', 'Jun'),
('Jul', 'Jul'),
('Aug', 'Aug'),
('Sep', 'Sep'),
('Oct', 'Oct'),
('Nov', 'Nov'),
('Dec', 'Dec'),
)
YEARS = (
('1995', '1995'),
('1996'...
I am looking at accessing the user who owns the content_type of a posted comment
Currently I can access the user who posts, the comment, however I would like to notify the person who owns the item...
I tried doing user = comment.content_type.user but I get an error.
In my main __init__.py file
As soon as I change that to user = reque...
I'm wondering if someone uses django wizard step by step but with back option? I have form with 5 steps and now it is 'one way form' but I would like to develop it by back option (of course data between steps should be remember). Any idea?
...