django

Error when wrapping the view of a 3rd-party Django app? (Facebook, django-socialregistration, django-profiles)

I'm using django-socialregistration to manage my site's connection with Facebook. When a user clicks the "Connect with Facebook" button, I am able to automatically create a new Django user and log them in. However, I also need to create a UserProfile (my AUTH_PROFILE_MODULE) record for them which contains their Facebook profile inform...

Django ImageField: files dont get uploaded...

Hello, I implemented some ImageFields in my model and installed PIL (not the cleanest install). Things seem to work as I get an upload button in the admin and when I call the .url property in the view I get the string with the filename + its upload property. The problem is that the file is not there, apparently it doesnt get uploaded onc...

Structuring Django Many-to-Many Relation

In writing an application for my school's yearbook committee, I've hit a bit of a dead end with modeling a specific relation. Currently I have a photo class class Photo(models.Model): photo = models.ImageField(upload_to="user_photos/") name = models.CharField(blank=True, max_length=50) rating = models.IntegerField(default=1000) wi...

How do you wrap the view of a 3rd-party Django app

How do you wrap the view of a 3rd-party app (let's call the view to wrap "view2wrap" and the app "3rd_party_app") so you can do some custom things before the app does its thing? I've set urls.py to capture the correct url: url( r'^foo/bar/$', view_wrapper, name='my_wrapper'), I've created my custom view: from 3rd_party_app.views...

Django Performance

I am using a django with apache mod_wsgi, my site has dynamic data on every page and all of the media (css, images, js) is stored on amazon S3 buckets liked via "http://bucket.domain.com/images/*.jpg" inside the markup . . . . my question is, can varnish still help me speed up my web server? I am trying to knock down all the stumbling b...

Django threaded comments - one level only

I'm looking at implementing django-threadedcomments and am wondering if it is able to restrict threading to replies made by a moderator/owner, similar to how Yelp handles user reviews and business owner replies. For example the comments would look like: "Comment 1" by User1 "Comment 2" by User2           "Reply 1" by Owner "Comment 3" ...

CSRF error in Django; How can I add CSRF to my login view?

I have a simple form I want users to be able to log into; here is the template code with the CSRF tag in it: <html> <head><title>My Site</title></head> <body> <form action="" method="post">{% csrf_token %} <label for="username">User name:</label> <input type="text" name="username" value="" id="username"> <la...

Django: Field.to_python not called on foreign key IDs?

I've got a subclass of Field: class MyIDField(Field): ... def to_python(self, value): return to_base_36(value) And I use it as a primary key like this: class Foo(m.Model): id = MyIDField(primary_key=True) class Bar(m.Model): foo = m.ForeignKey(Foo) Then the MyIDField.to_python function isn't called when I a...

Matching a datetime against a date in django

I have a django model with a DateTimeField called when which I want to match against a Date object. Is there a way to do that in django's queryset language better than Samples.objects.filter( when__gte = mydate, when__lt = mydate + datetime.timedelta(1) ) ...

Django template: Why block in included template can't be overwritten by child template?

To illustrate my question more clearly, let's suppose I have a include.html template with content: {% block test_block %}This is include{% endblock %} I have another template called parent.html with content like this: This is parent {% include "include.html" %} Now I create a templated called child.html that extends parent.html: ...

DJango Dev Server strange output ppcfinder.net/judge.php

Hi all, I wonder if anyone has seen this. I am developing a web app and the dev server just output the following when I was doing some testing. logging on [21/Oct/2010 13:42:56] "POST /members/logon/ HTTP/1.1" 302 0 [21/Oct/2010 13:42:57] "GET / HTTP/1.1" 200 20572 [21/Oct/2010 13:42:59] "GET http://ppcfinder.net/judge.php HTTP/1.1" 40...

Java framework for social network

Is there a Java analogue to Pinax/Django? (Perhaps an extension to Jboss Seam and/or functionality already built into Seam?) Please analyse and compare Pinax/Django, Seam, and any other good Java/Python frameworks in the following criteria (ranked in order of importance): Security (sensitive financial information) Ability to interact ...

How to pass a variable from settings.py to a view?

I'm getting the project path in my Django app in settings.py using: PROJECT_PATH = os.path.realpath(os.path.dirname(__file__)) I would like to use the PROJECT_PATH value in other views, such as for locating the path to files in my static path. How can I make this into an accessible variable? ...

Caching static files in Django

I was profiling the performance of my web application using Google's Page Speed plugin for Firebug and one of the things it says is that I should 'leverage caching' — "The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources". When I dug deeper I ...

How can I change the way the foreign key field is displayed in django admin?

Hi, My models look like this: Location: state county city street Building: name location = ForeignKey(Location) Now, in admin, when editing the Building, I want to have the ability to edit the Location in this way: So, it's like an inline, but with having Location in Building, not the oposite way. ...

Why does my website have a JQuery AJAX error , and there are no response headers?

When I click on "Request and Invite", you'll notice that there's a JQuery error...but it's weird. http://bit.ly/cuq5KV The code is pretty simple. The error seems to be happening on JQuery's file. I tried previous versions of JQuery (both compressed and uncompressed), but there were always problems. ...

uWSGI + Django + Virtualenv unable to pick up _functools (import error)

OK, So I have tried this with & without a virtualenv: uwsgi --home /home/auston/new_proj/ --socket /tmp/uwsgi2.sock --chmod-socket --module app_wsgi --pp /home/auston/new_proj/nikeshere --logto /tmp/uwsgi.log --master --processes 4 -P Pretty much no matter what, I get this: *** Starting uWSGI 0.9.6.5 (32bit) on [Thu Oct 21 08:05:44 2...

how do i use django with jython

hey dudes, currently i'm using django with python. I wanted to try using it with jython, so i installed the jython2.5.2b and edit the python.path to point to C:\Python26\Lib\site-packages I have also installed the django-jython extension in jython. However, I still encountered error ImportError: No module named django Does an...

Django query filter combining AND and OR with Q objects don't return the expected results

I try to combine AND and OR in a filter using Q objects. It looks like that the | behave like an AND. This is related to the previous annotate which is run in the same query and not as a subquery. What is the correct way to handle this with Django? models.py class Type(models.Model): name = models.CharField(_('name'), max_length=1...

Accessing previous array element in django template for loop.

Hi! I'm new to django and can't find a way to get this to work in django templates. The idea is to check if previous items first letter is equal with current ones, like so: {% for item in items %} {% ifequal item.name[0] previous_item.name[0] %} {{ item.name[0] }} {% endifequal %} {{ item.name }}<br /> {% endforeach ...