Free Python hosting
Is there a free working python host on which I can live test a django app? Google app engine is not an option. ...
Is there a free working python host on which I can live test a django app? Google app engine is not an option. ...
I have two models. We'll call them object A and object B. Their design looks something like this: class Foo(models.Model): name = models.CharField() class Bar(models.Model): title = models.CharField() Foo= models.ForeignKey('myapp.Foo') Now, suppose I want to make a method within Foo that returns all Bar objects that r...
I need to perform a filtered query from within a django template, to get a set of objects equivalent to python code within a view: queryset = Modelclass.objects.filter(somekey=foo) In my template I would like to do {% for object in data.somekey_set.FILTER %} but I just can't seem to find out how to write FILTER. ...
I would like to generate a report file from a view&template in django. Preferred file formats would be OpenOffice/ODF or PDF. What is the best way to do this? I do want to reuse the page layout defined in the template, possibly by redefining some blocks in a derived template. Ideally, the report should be inserted into an existing tem...
Say I have a form like: class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms. IntegerField(required=False) And I want to show it twice on a page within one form tag each time with a different prefix e.g.,: rest of page ... <form ..> GeneralForm(data,prefix="form1").as_table() GeneralForm(d...
In Django templates, is there a variable in the context (e.g. {{ BASE_URL }}, {{ ROOT_URL }}, or {{ MEDIA_URL }} that one can use to link to the "home" url of a project? I.e. if Django is running in the root of a project, the variable (let's call it R) {{ R }} in a template would be "/". If the root url is a sub-folder "http://host/X/" ...
I've been exploring the details of Django for about a week now and like what I see. However I've come upon some.. negativity in relation to fine-grained control of permissions to the CRUD interface. What I'm writing is an Intranet client management web-app. The organisation is about 6 tiers, and I need to restrict access to client group...
I have a two way foreign relation similar to the following class Parent(models.Model): name = models.CharField(max_length=255) favoritechild = models.ForeignKey("Child", blank=True, null=True) class Child(models.Model): name = models.CharField(max_length=255) myparent = models.ForeignKey(Parent) How do I restrict the choices ...
Given a model's instance object, how can I get the data base table's name? I don't want to specify names explicitly in the Meta class. ...
Is there a way to have a default parameter passed to a action in the case where the regex didnt match anything using django? urlpatterns = patterns('',(r'^test/(?P<name>.*)?$','myview.displayName')) #myview.py def displayName(request,name): # write name to response or something I have tried setting the third parameter in the u...
I am writing an application where I will be accessing the database from django and from a stand alone application. Both need to do session verification and the session should be the same for both of them. Django has a built in authentication/session verification, which is what I am using, now I need to figure out how to reuse the same se...
In my django application I am using a template to construct email body, one of the parameters is url, note there are two parametes separated by ampersand in the url. t = loader.get_template("sometemplate") c = Context({ 'foo': 'bar', 'url': 'http://127.0.0.1/test?a=1&b=2', }) print t.render(c) Af...
So, when playing with the development I can just set settings.DEBUG to True and if an error occures I can see it nicely formatted, with good stack trace and request information. But on kind of production site I'd rather use DEBUG=False and show visitors some standard error 500 page with information that I'm working on fixing this bug at...
I would like to use the django contrib.admin pages to edit my models, but call individual change page from my own views, an then return there after user clicks "save". Ideally this should happen by appending the return URL to the admin page's url (as in "...?_return_url=) Any hints? ...
I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way? ...
Is there explicit support for Single Table Inheritance in Django? Last I heard, the feature was still under development and debate. Are there libraries/hacks I can use in the meantime to capture the basic behavior? I have a hierarchy that mixes different objects. The canonical example of a corporation structure with an Employee class, ...
I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code: <img src="image.py?text=xxxxxxxxxxxxxx"> The problem is that I expect in the future the "text" field will get very long and the URL will become too large. From Googling around there doesn't ...
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI? ...
I am building a simple Django app that will use scribd to display documents. I would like to have a page where the administrator can upload documents to scribd through the website, since I need to know a few things about it before it gets to scribd. What is the best/easiest way to do this, display an upload page and then take the file th...
When starting a django application using python manage.py shell, I get an InteractiveConsole shell - I can use tab completion, etc. Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) When just starti...