hi there,
i'm making a notification system, so that a user in a virtual community to be announced when someone sends him a message, or starts following him (the follow relation is like a friend relation, but it is not necessarily reciprocal)
my view function:
def notification_view(request, last_checked):
u = Relation.objects.filter...
The ChoiceField creates a select html element and the options show the choice_label which is the _unicode_ of each model object.
How can I change the text of the choice_label without modifying _unicode_ ?
I have a Product model and I want to show in the options text the product name + price + link to edit.
I've searched in fields.py a...
I want to filter all Relation Objects where (relation= following relation in a virtual community) the date one has initiated the following is in the past, related to the moment now.
The following declaration seems to be wrong, as a bool object is not iterable.
Is there another way to do that?
d = Relations.objects.filter(date_follow < ...
So I have this model with multiple Many2Many relationship. 2 of those (EventCategorizing and EventLocation are through tables/intermediary models)
class Event(models.Model):
""" Event information for Way-finding and Navigator application"""
categories = models.ManyToManyField('EventCategorizing', null=True, blank=True, help_text="categ...
Hi,
When I render my formset, one of the field renders as a select box because it is a foreign field in the model. Is there a way to change this to a text input? I want to populate that field by using Ajax auto complete. Adding a widget to the modelform is not working because the modelformset_factory takes a model and not a model form.
...
I'm trying to install MySQLdb for python.
but when I run the setup, this is the error I get.
well I know why its giving all the missing file statements, but dont know where to change the bold marked location from.
Please help
gaurav-toshniwals-macbook-7:MySQL-python-1.2.3c1 gauravtoshniwal$ python setup.py build
running build
running ...
I have a model with two image fields, a source image and a thumbnail.
When I update the new source image, save it and then try to read the source image to crop/scale it to a thumbnail I get an "I/O operation on closed file" error from PIL.
If I update the source image, don't save the source image, and then try to read the source image ...
I utilize the standard python logging module. When I call python manage.py test I'd like to disable logging before all the tests are ran. Is there a signal or some other kind of hook I could use to call logging.disable? Or is there some other way to disable logging when python manage.py test is ran?
...
Is there any way to prevent ./manage.py test from running tests on installed apps like django.contrib.auth?
...
Hey, i was wondering if there is a way to enforce the 30 seconds limit that is being enforced online at the appengine production servers to the local dev server? its impossible to test if i reach the limit before going production.
maybe some django middlware?
...
I need to extract all records which have a field which does NOT have a unique value.
I can't figure out an elegant way to do it - using annotation or some other way. I see a "value_annotate" method to the object manager but it's unclear if it's at all related.
Currently I'm using the inelegant way of simple looping through all values a...
This is my view function
@csrf_request
def view_function(request, template_name):
c = {}
return return render_to_response(template_name, {'recipe' : objRecipeForm}, c, context_instance=RequestContext(request))
I also used a {% csrf_token %} in my template
The error I get is render_to_string() got multiple values for keyword a...
Hi,
Written some code in my view function :
This code reads a file from server . stores it in a list .passes to client
def showfiledata(request):
f = open("/home/tazim/webexample/test.txt")
list = f.readlines()
return_dict = {'list':list}
json = simplejson.dumps(list)
return HttpRespon...
Hey,
I want to do something like
return render_to_response("http://docs.google.com/View?id=bla", args)
and serve an external page with django arguments. Django doesn't like this (it looks for templates in very particular places).
What's the easiest way make this work? Right now I'm thinking to use urllib to save the page to somewh...
Whenever I change my python source files in my Django project, the .pyc files become out of date. Of course that's because I need to recompile them in order to test them through my local Apache web server. I would like to get around this manual process by employing some automatic means of compiling them on save, or on build through Ecl...
Hi,
I have a tricky Django problem which didn't occur to me when I was developing it. My Django application allows a user to sign up and store his login credentials for a sites. The Django application basically allows the user to search this other site (by scraping content off it) and returns the result to the user. For each query, it d...
Hi,
I sometimes have the need to make sure some instances are excluded from a queryset.
This is the way I do it usually:
unwanted_instance = Mymodel.objects.get(pk=bad_luck_number)
uninteresting_stuff_happens()
my_results = MyModel.objects.exclude(id=unwanted_instance.id)
or, if I have more of them:
my_results = MyModel.objects.exc...
Hello,
I am looking for the best way to have an history of my models (interger & float fields) in Django.
I read http://stackoverflow.com/questions/1952913/keeping-a-history-of-data-changes-in-database and it seems that triggers are the best option.
My idea is to stay database agnostic if possible.
How do you approach this issues in y...
When I was using the built-in simple server, everything is OK, the admin interface is beautiful:
python manage.py runserver
However, when I try to serve my application using a wsgi server with django.core.handlers.wsgi.WSGIHandler, Django seems to forget where the admin media files is, and the admin page is not styled at all:
gunicorn...
I'm new to Django. Today I created some Django custom tags which is not that hard. But now I wonder what is the best way to include some jQuery or some Javascript code packed into my custom tag definition. What is the regular way to include a custom library into my code? For example:
{% faceboxify item %}
So assume that it'll create a...