django

django fixtures: load multiple fixtures on syncdb

Hi, I have a lot of things in my initial_data.json right now. I wondered if there is a way to split the data in files (by model) so that all of the files are loaded via same manage syncdb command? Thanks, Nick I recently revisited the problem, and came up with a better way of hooking code to 'real' post_syncdb signal: http://www.dja...

How to customize form styled by django-uni-form?

I'm using django-uni-form to style my form using the filter my_form|as_uni_form: <form class="uniForm" id="my_form" method="post" action="./"> <fieldset class="inlineLabels"> {{ my_form|as_uni_form }} <div class="form_block"> <input type="submit" value="Submit"/> </div> </fi...

Django date filter to output "am" or "A.M."

The Django date template filter takes the format character "a" for "a.m." and "A" for "AM". How do you get lower case without periods or upper case with the periods? You can use lower and upper filters, but they will mess with month and day of the week formatting. ...

turbogears request/user object in templates and request context

Hi all, I am currently making the switch from Django to Turbogears 2.1 and am running into some problems that I could not find the answers to in the Turbogears docs. If tg developers read this, let me tell you that one of the best features Django has over TG is its documentation! 1) How do I access the request (user?) object within a m...

Django template and Python dictionary data structure question

I am trying to present a dictionary from my view.py at the HTML template such as: test = { 'works': True, 'this fails':False } and in the template: This works without a problem: {{ test.works }} But a dictionary key that is having an empty space between words such as 'this fails' doesn't work: {{ test.this fails }} I get this e...

How to connect an application with Facebook?

The topic may be a bit ambiguous. I am writing a Python application. I want to upload it on Facebook as a Facebook application (NOT Facebook Connect). But I am having the hardest time figuring out how to implement the features of my application with Facebook. My application currently uses a MySQL database. Now I want a user of Facebook...

Django general template controled by which variables?

I have been developing some Django app and there's some duplicated code for different Models. I'd like to create a generic table template and pass the Model class, a list of model instances, and Form classes to it so it can render the page and generate the forms to add/delete elements. Then create some generic add/delete views to work wi...

What are some famous websites built in Django?

Hi, I've tried to search it here and google'd it but can't find any info nor a relevant question. What are some famous sites that have been built in Django? Thanks! ...

Using Django Forms to display and edit?

I'm wrestling with how to best create HTML pages in Django that can either be used for displaying or editing data. That is, I'd like the field's values to appear as text in display mode, but in their widgets when in edit/add mode. It appears that Django wasn't designed to do this: the fields always appear in their widgets (eg, text input...

Django full-text search with MySQL InnoDB

How do you configure Django for full-text search with MySQL-InnoDB. MySQL Myisam engine supports full-text search but I will use InnoDB. Is that the best way to use Sphinx? If you explain your configuration I will appreciate. (By the way I wonder how it works with postgresql too.) ...

Examples of using Doctests in Django in an Agile / BDD way

I'm interested in learning how to Doctests and Unit tests in a more Agile / BDD way. I've found a few tutorials that seem reasonable, but they are just thumbnails. What I would really like to see is the source code of some Django projects that were developed BDD style. The things I'm unclear about are how do you handle request objects e...

Update Facebook Page's status using pyfacebook

I am attempting to add functionality to my Django app: when a new post is approved, I want to update the corresponding Facebook Page's status with a message and a link to the post automatically. Basic status update. I have downloaded and installed pyfacebook - and I have read through the tutorial from Facebook. I have also seen this s...

How to avoid username clashing with a large number of users in django?

I have an application that will handle a big number of users. The users are divided into 2 types: public and private. Furthermore the private users are comprised of two different companies (maybe even more in the future) and already have established usernames from a LDAP & active directories that will be used to pre-populate my applica...

How to do this GROUP BY query in Django's ORM with annotate and aggregate

I don't really have groked how to translate GROUP BY and HAVING to Django's QuerySet.annotate and QuerySet.aggregate. I'm trying to translate this SQL query into ORM speak SELECT EXTRACT(year FROM pub_date) as year, EXTRACT(month from pub_date) as month, COUNT(*) as article_count FROM articles_article GROUP BY year,month; which output...

django-registration and user profile creation

In my app i have the AUTH_PROFILE_MODULE set to users.UserProfile. This UserProfile has a function create which should be called, when a new user registers, and then create the UserProfile entry. According to the django-registration documentation all in need to do is setting the profile_callback entry in my urls.py. Mine looks like this...

ISO public Django apps developed Agile / BDD style with Doctest, Unitests and Selenium

I've found several blog posts where TDD/BDD is explained, but the examples are usually really basic. Usually they are just for Models. I want to see how people are really using BDD in Real Life. I'd love be pointed towards some Django apps that were built test first style so I can learn from them. I know that Rails had many examples, s...

facebook app in python showing file list

i am making a facebook app in python with django. now i have successfully resolved the callback url to my localhost account. but the app is not displaying on facebook. when i navigate to apps.facebook.com/'myappname', it authenticates and then displays the file list on project folder? ...

Creating a extended user profile

I have an extended UserProfile model in django: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) #other things in that profile And a signals.py: from registration.signals import user_registered from models import UserProfile from django.contrib.auth.models import User def createUserProfile(sender, ins...

Django: Problems with serving static files with non ascii names

Hi, I've moved my django application from one server to another, and spotted strange bug with media after it: Traceback (most recent call last): File "/usr/lib/python2.5/site- packages/Django-1.1.1-py2.5.egg/django/core/handlers/base.py", line 92, in get_response response = callback(request, *callback_args, **callback_kwargs) Fi...

Translate values dict-like in Django templates

In my Model I define choices along the lines of: LANG_CHOICES = ( ("Englisch", ( (u"en-gb", u"England"), (u"en-us", u"United States of America"), ), ) The field is defined as: lang_source = models.CharField(max_length=5, choices=LANG_CHOICES, default="en-gb") Naturally, in my template I'd want to display the...