django

Which Python API should be used with Mongo DB and Django

I have been going back and forth over which Python API to use when interacting with Mongo. I did a quick survey of the landscape and identified three leading candidates. PyMongo MongoEngine Ming If you were designing a new content-heavy website using the django framework, what API would you choose and why? MongoEngine looks like i...

Combining regroup with get_foo_display in Django templates

I'm using the regroup template tag to group queryset output on a Choices field. In the model: RESOURCE_TYPES = ( ('tut','External tutorial'), ('read','Additional reading'), ('org','Company or organization'), ) restype = models.CharField('Resource type',max_length=6,choices=RESOURCE_TYPES) ...

Can't run os.system command in Django?

We have a Django app running on apache server (mod_python) on a windows machine which needs to call some r scripts. To do so it would be easiest to call r through os.system, however when django gets to the os.system command it freezes up. I've also tried subprocess with the same result. We have a possibly related problem in that Djang...

what should I take into consideration when choosing a session implementation?

Hi, all. Yesterday, my supervisor told me that tmp-file-based session should be THE answer to session implementation, and I should abandon any idea of making sessions persistent. He argues that file-based session is much faster and eaiser to use than other choices like db-based or memcached-based implementations. What he said was real...

Django and mod_python config

My Django project is placed in /www/host1/htdocs/my/project, www and my are links to other actual folders. Apache has mod_python enabled. I have a .htaccess in project folder: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE project.settings PythonDebug On PythonOption django.root ...

How to get the app a Django model is from?

I have a model with a generic relation: TrackedItem --- genericrelation ---> any model I would like to be able to generically get, from the initial model, the tracked item. I should be able to do it on any model without modifying it. To do that I need to get the content type and the object id. Getting the object id is easy since I h...

Where is documentation about the "parser" methods ?

I want to know what this ( and other ) methods does: parser.compile_filter() ...

removing non ascii characters from a string using python / django

I have a string of HTML stored in a database. Unfortunately it contains characters such as ® I want to replace these characters by their HTML equivalent, either in the DB itself or using a Find Replace in my Python / Django code. Any suggestions on how I can do this? ...

is there a signal emiter/consumer engine (like in Django) for .NET (C#)

Has .NET (C#) anything like Django's Signals engine? Our business logic become really complicated over few years of adding new features. I'm going to re-architecture it. Currently all features are very coupled that makes regression errors while changing something one one place - some other place may be broken. I really like Django's ap...

How to output JSON from within Django and call it with jQuery from a cross domain?

For a bookmarklet project I'm trying to get JSON data using jQuery from my server (which is naturally on a different domain) running a Django powered system. According to jQuery docs: "As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQue...

Performing non-blocking requests? - Django

Hi folks, I have been playing with other frameworks, such as NodeJS, lately. I love the possibility to return a response, and still being able to do further operations. e.g. def view(request): do_something() return HttpResponse() do_more_stuff() #not possible!!! Maybe Django already offers a way to perform operations afte...

Installing OSQA on windows(Local system)

Hi I want to install osqa on windows local system for this i have downloaded bitnami-djangostack-1.1.1-2-windows-installer.exe which has in built django,python,mysql & apache. I have run a django example given on the django website. Its working fine. But i am confused how to install osqa. I have downloaded the source code available on...

Updating several records at once using Django

I want to create a list of records with checkboxes on the left side....kinda like the inbox in Gmail. Then if a user selects some or all of these checkboxes, then the selected record(s) can be updated (only one field will be updated BTW), possibly by clicking a button. I'm stuck on how to do this though....ideas? Display Code {% fo...

Defining ways to visualise admin fields - Django

Hi folks, I'm trying to add graphs to the admin interface, problem is that I have not found any documentation regarding this. I'm sure there are generally accepted ways of customizing the way fields are displayed, and I do not wish to follow any problematic route. Any ideas? Edit: this is a model I'm trying to reproduce! Un...

Tallying records using annotate() not working as should.

I have two classes: Vehicle and Issues....a Vehicle object can have several issues recorded in the Issues class. What I want to do is to have a list of all issues, with each vehicle appearing only once and the total number of issues shown, plus other details....clicking on the record will then take the user to another page with all thos...

Change text_factory in Django/sqlite

I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a "wrapping layer" between the external source and ...

Django1.1 file based session backend multi-threaded solution

Hi, all. I read django.contrib.sessions.backend.file today, in the save method of SessionStore there is something as the following that's used to achieve multi-threaded saving integrity: output_file_fd, output_file_name = tempfile.mkstemp(dir=dir, prefix=prefix + '_out_') renamed = False try: ...

Django custom template tag with 'parser.compile_filter(tokens[2])' doesn't work

I tried to implement the solution proposed by T. Stone on my question "how-do-i-pass-a-lot-of-parameters-to-views-in-django" ([link text][1]). I can't manage to get any result. It's difficult to find information about the compile_filter(), but as far as I understand cls(queryset=parser.compile_filter(tokens[2]), template=template) should...

PyDev and Django: PyDev breaking Django shell?

I've set up a new project, and populated it with simple models. (Essentially I'm following the tut.) When I run python manage.py shell on the command line, it works fine: >python manage.py shell Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for mo...

PyDev and Django: how to restart dev server?

I'm new to Django. I think I'm making a simple mistake. I launched the dev server with Pydev: RClick on project >> Django >> Custom command >> runserver The server came up, and everything was great. But now I'm trying to stop it, and can't figure out how. I stopped the process in the PyDev console, and closed Eclipse, but web pa...