I would like to compare a date to the current date in Django, preferably in the template, but it is also possible to do before rendering the template. If the date has already passed, I want to say "In the past" while if it is in the future, I want to give the date.
I was hoping one could do something like this:
{% if listing.date <= no...
I would like to change the default upload field (FileField) in an inlineformset_factory form, to use the AdminFileWidget from django.contrib.admin.widgets. The purpose of this is to show the path of the currently uploaded file as it does in the admin forms (perhaps there is another way to do this anyway?).
I have no trouble getting the...
Im looking to learn more about your testing flows with Django.
Background information
http://docs.djangoproject.com/en/dev/topics/testing/
Im encountering difficulties when using test driven development.
The test runner of Django constantly creates all db models in a test db when starting.
For our current projects (between 40 and 240 m...
I have the following django model (mapped to table 'A'):
class A(models.Model):
name = models.CharField(max_length=64, null=False)
value = models.IntegerField()
...
I want to perform the following simple query on top:
select avg(case
when (value > 0 and value <= 50) then 0
when (value > 50 and value < 70...
Hi,
I'm playing around with swfupload but I think it's a bit hard to integrate it in the django admin of a photo app of mine. So now I'm looking for an upload tool that opens the local filesystem in the browser an let you select files to be uploaded. I've seen this quite often in such online photo-developing-services...any ideas?
...
I need to change the below code to pass a file to a django request.Files object. Currently I pass the file location to django and allow it to open the file, unfortunately due to new ridiculous set in stone network restrictions django will no longer have access to anything outside of it's server.
The parameters I'm passing come from a v...
I am trying to use GDB's reverse debugging with a Django application. I get it running in GDB, but I can't make it run backwards.
I stopped my Django app with Ctrl-Z and then entered reverse-next at the gdb prompt, getting the error message "Target multi-thread does not support this command."
Am I doing it wrong? Isn't this possible?...
I'm developing a questionnaire app. The question model has a "type" field, lets say A and B. The "question" model is set as foreign key to two other models, ModelA and ModelB.
Its easy enough to add ModelA(or ModelB) as inlines for questionadmin.
But I want to dynamically change the inline fields which are shown on admin page, depending ...
I've heard of redis-cache but how exactly does it work? Is it used as a layer between django and my rdbms, by caching the rdbms queries somehow?
Or is it supposed to be used directly as the database? Which I doubt, since that github page doesn't cover any login details, no setup.. just tells you to set some config property.
...
I have this form in a Django application
In Firefox it works as charm,
and in Chrome/IE6 this won't do the post operation needed
Any ideas why ?
<form action="/lang/i18n/setlang/" method="post">
<input name="next" type="hidden" />
<input name="language" type="image" value="ar" src="/flags/flag_ar.jpg" onclick="this.form.submit()" tit...
Hi,
I want to replace a home-made comment object by a proxy of django.contrib.comments.models.Comment.
I modified my comments/models.py, added django.contrib.comments to my installed_apps and set COMMENTS_APPS to my comment app's name.
When running python manage.py syncdb (I use South), I get 'django.contrib.comments' in the 'not sync...
I have a fixture (json) which loads in development environment but fails to do so in server environment. The error says: "DatabaseError: value too long for type character varying(50)"
My development environment is Windows & Postgres 8.4. The server runs Debian and Postgres 8.3. Database encoding is UTF8 in both systems.
It is as if uni...
Hi!
I have the following model:
class MyUser(User):
# some fields...
contact = models.ManyToManyField("self", through='Contact', symmetrical=False, related_name="contact_set" )
class Contact(models.Model):
user1 = models.ForeignKey( MyUser, related_name="contact_set1")
user2 = models.ForeignKey( MyUser, related_name="...
Django saves the data but eventually raises an IntegrityError. If there is an error, why it is saving that data? And I'm sure that the uniqueness property is not violated on that data.
What is going on? Why is that error occurs? and how can I solve that?
...
hello,
i'm using django and i've the following template for uploading files using SWFUpload
the sxf object show, the download prosses seam to be working but wen the progress bar reatch 100% nothing append next, there is no post data receved by the sever.
did someone know where i'm wrong?
debug:
SWF DEBUG: Event: uploadError : IO Error ...
Hello!
I have something like this in my model:
class Artykul(models.Model):
id = models.AutoField(max_length = 5, primary_key = True)
tytul = models.CharField(max_length = 255)
kategoria = models.ManyToManyField(Title, limit_choices_to = choices_limit)
dodano = models.DateField(auto_now_add = True)
autor = models.CharField(max_leng...
I am making use of Django's contrib.comments and want to know the following.
Are there any utils or app out there that can be plugged into an app that sends you a notification when a comment is posted on an item?
I haven't really worked with signals that much, so please be a little bit descriptive.
This is what I came up with.
from d...
I'll try to describe my problem with a simple example. Say I have items of type Item and every item relates to a certain type of Category. Now I can take any two items and combine into an itemcombo of type ItemCombo. This itemcombo relates to a certain category called ComboCategory. The ComboCategory is based on which categories the item...
I'm using some subclasses in my Django app, and I'm continuing that logic through to my admin implementation.
Currently, I have this admin defintion:
class StellarObjectAdmin(admin.ModelAdmin):
list_display = ('title','created_at','created_by','updated_at','updated_by)
Now, I have a Planet class, that is a subclass of StellarObject...
I am trying to cache query results on my django app. However, it seems that it is caching the whole app. I tried following logi:
def cacheView():
result = cache.get('key')
if result is None:
result = Model.objects.get(id=1)
cache.set('key', 'result')
I am calling this method when user logs in. However, if I try to logout a...