django

Trouble setting up sqlite3 with django! :/

I'm in the settings.py module, and I'm supposed to add the directory to the sqlite database. How do I know where the database is and what the full directory is? I'm using Windows 7. ...

Make a link that maintains get params?

I've got an HTML table that lists a bunch of entries. I want to make the column headers clickable to be sorted. Problem is, I already have a bunch of filters in the URL (stuff like ?min_price=200&max_price=6000). How can I build the link such that it keeps these params in tact? Is there a function for it? Do I have to do it in the view? ...

#django what method is used to represent a model field in admin

I am trying to subclass CharField with a custom unicode method. Basically, I want to be able to call my custom crypto method on the value that is returned by the default model field. I tried the following, but it seems that admin is getting the values some other way. It seems to me that this would be the most pythonic way to implement...

mod_python with multiple django projects

I tried to configure my django project on a shared hosting (which supports mod_python). Following the procedures, i did make it with their proposed folder structure in the end: [folder structure] /.. /MYAPP /public_html .htaccess in .htaccess PythonPath "['/home/MYACCOUNT/' ] + sys.path" SetHandler python-program Py...

What is the correct way to pass a json object from a django view.py to a .js file?

Hi, I have a json object that i send as a template variable to my html template. If i have an external .js file what is the best way to pass it to it? I read on another thread to declare the var inside the <script> tag in the <header>, but that would open up security issues? What is the standard way? Thanks, David ...

Django + socialauth: login with openid or admin

hi, i'm trying to implement the socialauth module to my django project, but i get a bit confused on its relation toward the admin site. My problem: the @login_required decorator redirects me to the admin login page instead of the accounts/login/ page to log in via openid. how do i offer the possibility to the user to log in via admin ...

Django - Call class as view function

views.py: class ajax_profile(): def __init__(self, request): username = request.REQUEST.get('username','') email = request.REQUEST.get('email','') password = request.REQUEST.get('password','') action = request.REQUEST.get('action','') options = { 'check_username' : self.check_username(username),...

Flex 4 + Django: Testing and Release Options

I am creating a django-based site that will serve flash apps that occasionally access data via pyamf. I need to be able to easily test the flash in the context of the django framework, i.e. with all the login cookies and everything available, so that when I make a pyamf call, it has all the user context there. And I need to be able to te...

When should I submit my Django form's results?

The contents of my form must be submitted to another application server for validation and execution (specifically, I call a RESTful web service with the posted values in the form). The service will either return a 200 SUCCESS or a 400/409 error with a body that describes the exact field errors. When should I do this submission? Should ...

What is the best way to backup a django project?

I maintain a couple of low-traffic sites that have reasonable user uploaded media files and semi big databases. My goal is to backup all the data that is not under version control in a central place. My current approach At the moment I use a nightly cronjob that uses dumpdata to dump all the DB content into JSON files in a subdirectory...

How to get a layout-less version of a page?

I've got some pages such as the user-agreement that I want to appear with or without the layout (extends tag) depending on how it is called. I'm using jQuery Fancybox to load up these pages in iframes. If JS is disabled, the links should open in a new window w/ the full layout, otherwise, if they're in an iframe, they don't need the layo...

Django socialauth: what is the best fork?

Hi, i'm trying to install socialauth in my django application to have openid and facebook login, but it seems there are various versions of socialauth: uswaretech which has a poor doc, a very bad template system elfsternberg which is defended by this but was last updated nov09 agiliq update one month ago but seems to have even more b...

Django extra() and None values

Hi, I have a query in extra() that sometimes returns no rows. In that case, I need that variable assigned to be None for sorting purposes. Is there a way to do this? ...

Why do some Django ORM queries end abruptly with the message "Killed"?

Sometimes, when fetching data from the database either through the python shell or through a python script, the python process dies, and one single word is printed to the terminal: Killed That's literally all it says. It only happens with certain scripts, but it always happens for those scripts. It consistently happens with this one sin...

Choices from model in Django

I have a model that picks up the choices defined in CHOICES like this: CHOICES = ( ('1', '1'), ('2', '2'), ('3', '3'), ) class select(models.Model): first = models.CharField(max_length=3, choices=CHOICES) second = models.CharField(max_length=3, choices=CHOICES) I would like to be able to add, remove or change choices ...

Adding extra fields not working in my django form

I have a model with a custom property class RecipeIngredient(models.Model): recipe = models.ForeignKey(Recipe) ingredient = models.ForeignKey(Ingredient) serving_size = models.ForeignKey(ServingSize) quantity = models.IntegerField() order = models.IntegerField() created = models.DateTimeField(auto_now_add = True)...

Django debugging with Eclipse and PyDev

Hi, I just managed to get debugging my django site 'kind of' working in Eclipse. All my breakpoints get caught just fine, but I have to restart the server every time I make a code change. I think this is because I'm using the --noreload argument when kicking off the server. Is there any way to setup Eclipse debugging so that I can chan...

Django ModelForm validated without submitting

I have a form on my home page. My view for that looks like this: from djangoproject1.authentication import forms from django.http import HttpResponseRedirect from django.shortcuts import render_to_response def main(request): uf = forms.UserForm() upf = forms.UserProfileForm() return render_to_response("authentication/index...

Doing SSL with Reverse Proxy

We have one server serving Django content using mod_wsgi and one server in our DMZ reverse proxying all users. The only way to get to the content is via the reverse proxy and we want some content to be secure and some not to be. Is the best way to set it up having SSL on both servers, or is that a waste? Should I move all the encryption...

django openid "Error using OpenID"

I am using django-openid from http://github.com/simonw/django-openid. But no matter whatever openid i enter it gives out this error: "Error using OpenID", "The OpenID was invalid" Update: Got it to work with django-openid. It seems the error was because i was using localhost. So i had to create a local openid server to make it work. Als...