django

tools to aid in browsing/following (large) python projects' source code

A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions...

How to open a file on app engine patch?

I tried to read a file in a view like this: def foo(request): f = open('foo.txt', 'r') data = f.read() return HttpResponse(data) I tried to place the foo.txt in almost every folder in the project but it still returns [Errno 2] No such file or directory: 'foo.txt' So does anybody knows how to open a file in app engi...

Restarting a Django application running on Apache + mod_python

I'm running a Django app on Apache + mod_python. When I make some changes to the code, sometimes they have effect immediately, other times they don't, until I restart Apache. However I don't really want to do that since it's a production server running other stuff too. Is there some other way to force that? Just to make it clear, since ...

Best practice for uploading and image file with Django Forms (Django 1.0)

Hi friends, could you please help me to get image upload working on a view with django forms Models.py class User_Profile(models.Model): user = models.OneToOneField(User, unique=True, related_name='profile') photo = models.ImageField(upload_to = 'profiles/', null=True, blank=True) Forms.py class ProfileForm(forms.ModelForm): ...

storing file content in DB

I am making a model in which i have a filefield.I wan to store file content in the DB column instead of file path.ANy suggestions ...

Django queries, generic content_types

I have a question about django content_types In the example of filtering a QuerySet for a generic content type on http://www.djangoproject.com/documentation/models/generic_relations/ there are the following lines. ctype = ContentType.objects.get_for_model(quartz) TaggedItem.objects.filter(content_type__pk=ctype.id, object_id=quartz.id...

handler not working in gae python

I have two handlers in webapp.WSGIApplication for two forms in a django template, one of the handler works on dopost but the other one goes to blank page. Why is this so? ...

Django named urls unrecognized by template url tags

In projects/urls.py I have: urlpatterns = patterns('bizteen.projects.views', url(r'^browse/$', 'browse', name='projects-browse-main'), url(r'^browse/(\d+)/$', 'browse', name='projects-browse'), url(r'^create/$', 'create', name='projects-create'), url(r'^(\d+)/$', 'view_project', name='projects-view'), ) And in a templa...

Removing the Label From Django's TextArea Widget

How do I remove the label that comes attached to the TextArea I am trying to use with Django? I'm trying to find ANY information about this issue but I cannot seem to find anything relating to my problem. This is what I'm doing in my code: class CommentForm(forms.Form): comment = forms.CharField(widget=forms.Textarea()) This is th...

How Do I Remove Text From Generated Django Form?

So earlier I asked a question about removing the label that Django forms have by default. That worked out great, and I removed the label. However, the text that is generated by the form is still there! I would very much like to remove the text. Here is what I mean: <p>Text: <textarea rows="10" cols="40" name="text"></textarea></p> I w...

How do you do something after you render the view? (Django)

I want to do something after I have rendered the view using return render_to_response() Are signals the only way to do this? Do I need to write a custom signal or does request_finished give me enough information? Basically I need to know what page was rendered, and then do an action in response to that. Thanks. UPDATE FROM COMMENTS...

Generating forms from models (a la django ModelForms) in Objective-C

I'm taking the plunge into iPhone development after about two years working with django. As I've done tutorials and read documentation, one of the things that strikes me as inconvenient about the various libraries used in iPhone development is the amount of repetition required when creating user input forms for data models. I know of...

Django: serving ADMIN media files

Hi all, I've been successfully serving media files for the normal MEDIA files, but when I tried serving admin media files, I failed. please kindly help me locating the problem, as I've tried to troubleshoot the problem for several hours already with no luck (been googling too and read the django doc about serving static files as well). ...

How to recommend the next achievement

Short version: I have a similar setup to StackOverflow. Users get Achievements. I have many more achievements than SO, lets say on the order of 10k, and each user has in the 100s of achievements. Now, how would you recommend (to recommend) the next achievement for a user to try for? Long version: The objects are modeled like this in ...

Differences in Django Template Inheritance between 0.96 and 1.0?

Now that Google App Engine natively supports Django 1.0, I updated with the following code: from google.appengine.dist import use_library use_library('django', '1.0') I am now getting template errors relating to template inheritance. For instance, if I have: {% extends "../base.html" %} Referring to a base.html in the parent direct...

Django Autoselect Foreign Key Value

I have a model that contains a foreign key value, then in the form generated from this model, I want to auto select the record's key according to the record I'm adding the form's contents to...I've tried the below code, but it tells me QuerySet doesn't contain vehicle stock = Issues.objects.filter(vehicle=id) form = IssuesForm(initial=...

Best practice for managing project variants in Git?

I have to develop two Django projects which share 90% of the same code, but have some variations in several applications, templates and within the model itself. I'm using Git for distributed source-control. My requirements are that : common code for both projects is developed in one place (Project1's development environment) periodic...

How to set timeout for database connection in django

I have mysql database as engine for django. Django works thought nginx via fastcgi with timeout in 1 min (after that nginx says "504 gateway time-out"). If database gone down, django is trying reconnect to DB and waiting for response from it. And waiting for response too long (more than 1 minute) that nginx returns to client the 504 err...

Django Database Caching

I'm working on a small project, and I wanted to provide multiple caching options to the end user. I figured with Django it's pretty simplistic to swap memcached for database or file based caching. My memcached implementation works like a champ without any issues. I placed time stamps on my pages, and curl consistently shows the older tim...

Django beginner problem: manage.py dbsync

I'm running ubuntu 9.04 32b and got django from Synaptics. My settings.py is configured for a sqlite3 database. I've been through this tutorial and got the following error when trying to run the command python manage.py syncdb : Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/...