django

What is the maximum size of document to return from a REST API?

I am considering creating a RESTful web service which will return a lot of data. What do people think is the maximum size of xml document that should be returned in one get from a web services API? I would estimate the size of the result set to be 100Mb and time to produce this would be about 2h. How much time is a reasonable maximum ...

is there a way to generate pdf containing non-ascii symbols with pisa from django template?

Hi. i'm trying to generate a pdf from template using this snippet: def write_pdf(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), result) ...

What to do if Django's trunks own unit tests fail?

I work off of the Django trunk and notice that the unit tests for the Django modules in the trunk always have failures. Is the Django trunk supposed to pass all of its own unit tests? Here are some of the example errors: ====================================================================== ERROR: test_password_change_fails_with_inva...

Reusing Admin forms for user views in django?

Django is making very nice forms after creating a models.py and an admin.py. How can I reuse these forms (with the extra nice handling of foreign keys and many-to-many fields) in my own views? ModelForm does only generate "simple" forms. Where do I get the extra batteries? ...

django queryset excluding entries in second model

Hello, I'm making a little vocabulary-quiz app, and the basic model for a word is this: class Word(models.Model): id = models.AutoField(primary_key=True) word = models.CharField(max_length=80) id_image = models.ForeignKey(Image) def __unicode__(self): return self.word class Meta: db_table = u'word' ...

Python/Django: Which authorize.net library should I use?

I need authorize.net integration for subscription payments, likely using CIM. The requirements are simple - recurring monthly payments, with a few different price points. Customer credit card info will be stored a authorize.net . There are quite a few libraries and code snippets around, I'm looking for recommendations as to which work b...

How to setup Django website in Amazon EC2 hosting?

Can someone give specific steps how to implement hosting a Django based website by using Amazon EC2 hosting service? Is that possible? My website source code can be found here I goolged and found this article But before doing anything I just want to get some basic ideas about Amazon EC2 hosting. ...

No indexers created by Djapian for Django

I am working through the tutorial for setting up Djapian and am trying to use the indexshell (as demonstrated in this step). When I run the command 'list' I get the following output: Installed spaces/models/indexers: - 0: 'global' I therefore cannot run any queries: >>> query No index selected Which leads me to attempt: >>> use 0 ...

django generic templates

So, Generic views are pretty cool, but what I'm interested in is something that's a generic template. so for example, I can give it an object and it'll just tostring it for me. or if I give it a list, it'll just iterate over the objects and tostring them as a ul (or tr, or whatever else it deems necessary). for most uses you wouldn't ...

How to obtain a count of objects per auth.user?

I have a Project model similar to: class Project(models.Model): ... lead_analyst=models.ForeignKey(User, related_name='lead_analyst') ... I want to use django aggregation to return all users with a count of projects per user. Something like: models.User.objects.annotate(project_count=Count('project_set')) Only that does...

Django ignoring my DATABASE_ENGINE setting -- sometimes

I've got several sites, each with a distinct settings file -- and with distinct names. There's a floral theme to all the variant settings. We have to keep the sites separate. C:\Proj-Carnation> echo %DJANGO_SETTINGS_MODULE% path.to.settings_carnation_win32 We have many test procedures which don't use the built-in django-admin.py tes...

Use javascript to generate a templatetag based on events after document ready?

I am working with the new version of django-threadedcomments and making some progress; it integrates nicely with django's commenting system, however, I'm stuck and not sure how to proceed. For threaded comments to work, the user needs to select a comment to "reply to" and then the correct submit form is brought up (with the appropriate ...

Why do I have so many DeadlineExceededErrors with google-app-engine-django?

I'm using google-app-engine-django to run Django 1.1 on Google App Engine and I'm getting lots and lots of DeadlineExceededErrors, sometimes with . My entire app is quite simple, and it's happening throughout my app, so I suspect that there is a problem with my basic settings. Any advice would be greatly appreciated! Sample error: <cla...

Django - replacing built-in templatetag by custom tag for a whole site without {% load .. %}

I want to replace standart {% if %} template tag by "smart if" custom tag from this snippet, because I don't want to write {% load smart_if %} every time. And also "smart if" will come into core template system very soon I forgot where I saw piece of code, that do this. Does anyone know, how to replace built-in templatetag? ...

How do I customize Django's Flatpage to display a new field on the change list page of the admin?

In my flatpage admin change list page, mysite.com/admin/flatpages/flatpage/, I can see the fields: URL Title Is there a way to also show the field Site? I associate my flatpages to specific sites. The bad way to do it is by going to the actual Flatpage admin source django/contrib/flatpages/admin.py and create a method which will dis...

Django Forms - Can the initial value of one field be dependant on another?

Example, for this form: >>> class CommentForm(forms.Form): ... name = forms.CharField(initial='class') ... action = forms.ChoiceField(...) Can I have the choices in the action field be different depending on what is in the name field? ...

How do I move data from Postgres to MySQL running on Amazon's RDS?

I need to move a database with a Django schema from Postgres to MySQL, running on Amazon's RDF. I can re-generate the tables using manage.py, but I'm still looking for a way to migrate over all of the row data. Does anyone know a clean way of moving it over? Are there any gotchas to watch out for with Amazon's RDF? ...

Data Structure for storing a sorting field to efficiently allow modifications

I'm using Django and PostgreSQL, but I'm not absolutely tied to the Django ORM if there's a better way to do this with raw SQL or database specific operations. I've got a model that needs sequential ordering. Lookup operations will generally retrieve the entire list in order. The most common operation on this data is to move a row to th...

post_save in django to update instance immediately

hello, I'm trying to immediately update a record after it's saved. This example may seem pointless but imagine we need to use an API after the data is saved to get some extra info and update the record: def my_handler(sender, instance=False, **kwargs): t = Test.objects.filter(id=instance.id) t.blah = 'hello' t.save() class...

How to store arbitrary name/value key pairs in a Django model?

I have a fixed data model that has a lot of data fields. class Widget(Models.model): widget_owner = models.ForeignKey(auth.User) val1 = models.CharField() val2 = models.CharField() ... val568 = ... I want to cram even more data into this Widget by letting my users specify custom data fields. What's a sane way to ...