django

server reboot has caused django project to lose directories

A fully functional Django project as well as a couple in development have all broken following the rebooting of the server. In addition to some pieces of the Django admin returning errors as well as missing .js and .css files, I'm getting errors like this when viewing pages that include images uploaded through the admin. Exception Typ...

How do I filter values in a Django form using ModelForm?

I am trying to use the ModelForm to add my data. It is working well, except that the ForeignKey dropdown list is showing all values and I only want it to display the values that a pertinent for the logged in user. Here is my model for ExcludedDate, the record I want to add: class ExcludedDate(models.Model): date = models.DateTimeField...

In Django, how do I filter where language column = "null"?

MyTable.objects.filter(where language column = null) How can that be done? Thanks. ...

In Django : How to serialize dict object to json ?

I have this very basic problem, >>> serializers.serialize("json", {'a':1}) Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/pymodules/python2.6/django/core/serializers/__init__.py", line 87, in serialize s.serialize(queryset, **options) File "/usr/lib/pymodules/python2.6/django/core/seria...

How to change language from Django URL?

Hi, i want to change the language when the user introduce in the url the locale, something like this http://mysite.com/es/, http://mysite.com/es/article-name, http://mysite.com/en/. how can i do that? Thanks ...

jquery json null when using localhost

I am trying to load json generated by my django app. It works when I save the json output and load it from a static file. However, when I make a call to a server it returns null. JSON {"users": [ { "id": 1, "name": "arnold" }, { "id": 2, "name": "frankie" } ]} Ajax call $.ajax({ u...

Django - The included urlconf doesn't have any patterns in it

My website, which was working before, suddenly started breaking with the error "ImproperlyConfigured at / The included urlconf resume.urls doesn't have any patterns in it" The project base is called resume. In settings.py I have set ROOT_URLCONF = 'resume.urls' Here's my resume.urls, which sits in the project root directory. fro...

How do I limit the amount of login retries in Django

I am trying to get a login form I have in django to only allow three login attempts before redirecting to a "login help" page. I am currently using the builtin "django.contrib.auth.views.login" view with a custom template. How do I force it to redirect to another page after n failed login attempts? ...

Using Django Admin for a custom database solution

A client wants to have a simple intranet application to manage his process. He runs a Quarry and wishes to track number of loads delivered per day and associated activities. Since I knew about Django's excellent Admin interface, I figured I could define the "Schema" in models.py and have Django Admin generate the forms. I did exactly t...

Display progress bar while an image gallery is loading on django template.

I want to display a progress bar (or loading icon) while a image gallery is loading on django template. Image gallery is having a div in the template and for that div only the progress bar should appear. Please refer to http://www.openstudio.fr/jquery/ as I am using this gallery ...

use of ajax in django

Hi, I am new to ajax and django. I have written own XMLHttpRequest call on browser side I will have to manually set the header request.META['HTTP_X_REQUESTED_WITH'] to string XMLHttpRequest . How can I access these headers on browser side ...

add extra data to response object to render in template

İ ned to write a code sniplet that enables to disable connection to some parts of a site. Admin and the mainpage will be displayable, but user section (which uses ajax) will be displayed, but can not be used (vith a transparent div set over the page). Also there is a few pages which will be disabled. my logic is that, i write a middlewa...

HowTo init Django model, before using it?

Hi. I'm new to python and django. Apps | Versions: Python 2.6.2 Django (working with PostgreSQL) Question: I wrote a simple model: class OperationType(models.Model): eid = models.IntegerField() name = models.TextField(blank=True) description = models.TextField(blank=True) def __unicode__(s...

Add multiple records in django model using signal

I've a model called broadcastinfo, It has fields like.. info,userid. userid is excluded. when i add an new info, my broadcastinfo table should get the records of all userid from user table and the given message for each userid. Im trying this via signal.Any idea is highly appreciated. Thanks ...

How does django signals work?

How does Django's event routing system work? ...

Is there a chance that sending an email via a thread could ever fail to complete?

I have a project where I send a couple of emails via a seperet thread, to speed up the process for the end-user. It works successfully, but i was just wondering whether there were any potfalls that i might not have considered? My greatest fear is that the user clicks a button, it says that the message has been sent (as it will have been ...

django username in url, instead of id

Hello, in a mini virtual community, i have a profile_view function, so that i can view the profile of any registered user. The profile view function has as a parameter the id of the user wich the profile belongs to, so that when i want to access the profile of user 2 for example, i call it like that: http://127.0.0.1:8000/accounts/profi...

Is there a way to force a template to get translated to a certain language without passing RequestContext?

I'm rendering a template with a management command (something I need for producing documentation in my native language). So I've no request object, so no RequestContext. Is there a way I can force the template rendering process to lookup translation strings from a particular language other than English? ...

django sending emails

Hay, i can't seem to send emails using send_mail(), and I'm not sure why. Here's my details settins.py EMAIL_HOST = 'localhost', EMAIL_PORT = 25 My view from django.core.mail import send_mail send_mail('Subject here', 'Here is the message.', '[email protected]', ['[email protected]'], fail_silently=False) This fails with the err...

trunk works tag doesn't? ---ImportError: No module named 2.1.2

Very confused. In my workspace, the trunk works fine when I do a: python ./manage.py runserver 9090 However when I tag it @ 2.1.2 and then check it out clean from the repository to a temporary directory on my desktop.. I get the following error: Traceback (most recent call last): File "./manage.py", line 33, in execute_manag...