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...
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...
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 ...
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):
...
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
...
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...
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?
...
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...
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...
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...
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...
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...
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).
...
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 ...
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...
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=...
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...
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...
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...
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 "/...