django

C# vs Python: XML Handling/Processing Productivity

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...

possible bug in django models

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 ...

How to delete a record in django models.

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):` ----------- ...

Django web interface components

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 ...

How to get field with ForeignKey('self') without the possibilty to link to same entry?

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 ...

Django, Python calling Python code without waiting for response?

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...

Migrating data to Postgres from Mysql with Django - how do I migrate generic table data, not model specific?

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...

Django TemplateSyntaxError

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...

django-registration 0.8 signal not working

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...

Django login without authenticating

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...

Django request impossibly slow, can't find why

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...

Django LEFT OUTER JOIN on TWO columns where one isn't a foreign key

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_...

Pass success_url to the activate

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 ? ...

trying to integrate some apps to my project

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 =...

Problem loading Django fixture: IntegrityError: (1062, "Duplicate entry '4' for key 'user_id'")

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, ...

django-threadedcomments supported in django 1.2

Is django-threadedcomments 0.52 supported by django 1.2? ...

How can I have my DateTimeField filled in automatically for my admin entries?

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 ...

Smart Loop List Creation in Python for Django Choice fields

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'...

Django notification comment get owner

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...

Django - form wizard step by step

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? ...