django

Facebook, Django, and Google App Engine

I'm experimenting with app-engine-patch (Django for GAE) on Google App Engine. And I would like to write a Facebook application. Is it possible to use PyFacebook and its middleware? Or is there some other solution? ...

Dynamic Language Features and Meta-Programming Used in Django

Any good summary articles of the dynamic language and meta-programming features of Python that get utilized by Django? Or can we build that out here? Setting this up as a wiki-style entry. ...

Formatting date times provided as strings in Django.

In my Django application I get times from a webservice, provided as a string, that I use in my templates: {{date.string}} This provides me with a date such as: 2009-06-11 17:02:09+0000 These are obviously a bit ugly, and I'd like to present them in a nice format to my users. Django has a great built in date formatter, which would do ...

Django : Timestamp string custom field

I'm trying to create a custom timestamp field. class TimestampKey(models.CharField): __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): import time kwargs['unique'] = True kwargs['max_length'] = 20 kwargs['auto_created'] = True kwargs['editable']=False super(TimestampKey, sel...

HTTP Post of XML string and save it as .xml on server (django/GAE)

Trying to send a XML string (client) to my web app which is running on GAE using django. Idea is to basically have a post handler which will extract the XML content and save it in plain .xml file and return the filename in response to client If anybody has any idea or have tried similiar thing, would help me go fast. Thanks in advance...

Efficient week statistics for a QuerySet

I am working on an open source Django time tracking app, Djime, and I'm trying to come up with a more efficient way to produce statistics. So far, we've had some rather long-winded procedural code that would get all TimeSlices for a period, and collate them together in a huge nested list/dictionary mess. What I'd like to do is to set up...

disable a block in django

I want to disable a block in development and use it in deployment in google apps in python development. What changes do i need to make in template or main script? ...

Django: How can I change a ModelForm's Many2ManyField (select tag) choices verbose values?

For example: I have the follow model class Categories(models.Model): name = models.CharField(max_length=100,verbose_name="Category Name") parent_cat = models.ForeignKey('self',verbose_name="Parent Category",null=True,blank=True,related_name="child_cat") description = models.TextField(verbose_name="Category Description",blan...

Django reading old model?

I changed the model, synced the db, and now when i do: Prs = Products.objects.filter(PrName__icontains='bla') I get the error: ERROR: column search_products.pr_name does not exist LINE 1: SELECT "search_products"."id", "search_products"."pr_name", ... But pr_name was the old model, this is how the new model looks like: class ...

Template in Django

Inline template In my template can I use a <a href> tag? I want that if there is a field named 'id' it should give a href link over there. I have tried following options: 1){% ifequal field.field.label "Id" %} <a href =../../{{field.field}}>click here </a> 2){% ifequal field.field.label "Id" %} <a href ="../../{{field.field}}">clic...

Returning pure Django form errors in JSON

Hi I have a Django form which I'm validating in a normal Django view. I'm trying to figure out how to extract the pure errors (without the HTML formatting). Below is the code I'm using at the moment. return json_response({ 'success' : False, 'errors' : form.errors }) With this, I get the infamous proxy object e...

Experiences of creating Social Network site in Django

I plan to sneak in some Python/Django to my workdays and a possible social network site project seems like a good possibility. Django itself seems excellent, but I am skeptical about the quality of large amount of Django apps that seem to be available. I would like to hear what kind of experiences you may have had with Django in creati...

adding a **kwarg to a class

class StatusForm(ModelForm): bases = forms.ModelMultipleChoiceField( queryset=Base.objects.all(), #this should get overwritten widget=forms.SelectMultiple, ) class Meta: model = HiringStatus exclude = ('company', 'date') def __init__(self, *args, **kwargs): super(StatusForm, self).__init__(*args, **kwargs) if kwarg...

Tying in to Django Admin's Model History

The Setup: I'm working on a Django application which allows users to create an object in the database and then go back and edit it as much as they desire. Django's admin site keeps a history of the changes made to objects through the admin site. The Question: How do I hook my application in to the admin site's change...

Django, mod-wsgi, and daemon mode; problem "bash:fork:cannot allocate memory"

Hello, I would appreciate if someone can provide feedback or point me in the correct direction. I am unable to execute any terminal commands on a remote server when three django sites are running in daemon mode. I do not have a problem when I use embedded mode on one or two sites. When I enter the commands I only get "-bash:fork:cannot...

Admin Form Integration for Custom Model Fields in Django

I need a model field composed of a numeric string for a Django app I'm working on and since one doesn't exist I need to roll my own. Now I understand how "get_db_prep_value" and such work, and how to extend the Model itself (the django documentation on custom model fields is an invaluable resource.), but for the life of me I can't seem ...

Django Relational database lookups

I cant figure out how to do relationships. I have a products model and a stores model. A product has a foreign key to the stores. So i would like to get the product name, and the store name in the same lookup. Since the products model is: class Products(models.Model): PrName = models.CharField(max_length=255) PrCompany = models....

Sharing transaction scope between threads in python/django? (PostgreSQL)

Is there any way to share same transaction between two threads in a django-based code? The problem is that I have 1.1's TestCase (those that wrap individual tests into transactions) that are intended to test code that is running in a different thread [a sort of asynchronous testing]. So these test create some data that is intended to be...

Django + GWT or Jquery...

I have made a complex models structure in django. I had planned to render this structure using GWT, but with python the option to communicate whit it are: - using JSON and in this case I have to duplicate the models structure in javascript objects (see gwt tutorial). - python-gwt-rpc is a remote procedure call library compatible with g...

Django pre_save signal called when commit=False

I am writing a Django application that will track changes to the models, in a similar way to the admin interface. For example, I will be able to display a list of changes to a model, that look something like Changed Status from Open to Closed. I am using the pre_save signal to do this, comparing the relevant fields between the existing ...