Overlap in terminology makes search for answers difficult for this one.
I'm looking for advice on the best way to implement a multiple-column display of my QuerySet that fills each column top to bottom over X columns. Meaning that the number of items in each column equals the QuerySet count divided by X (number of columns).
Using Offs...
I'm curious if there's any way to do a query in Django that's not a "SELECT * FROM..." underneath. I'm trying to do a "SELECT DISTINCT columnName FROM ..." instead.
Specifically I have a model that looks like:
class ProductOrder(models.Model):
Product = models.CharField(max_length=20, promary_key=True)
Category = models.CharFi...
In my blogging app I need a structure (created as a variable in context processor) that will store months number and corresponding year of 5 consecutive months till current one. So if current month is december, we will have year: 2010 and months: 12,11,10,9,8. If month will be january we will have years 2010: months: 1 and years: 2009 mo...
So I've created a form that includes the following item
<input type="file" name="form_file" multiple/>
This tells the browser to allow the user to select multiple files while browsing. The problem I am having is is that when reading / writing the files that are being uploaded, I can only see the last of the files, not all of them. I w...
hi guys, I encountered an error when doing the following retrieval:
class status(models.Model):
pid = models.IntegerField()
phase = models.TextField()
rejected = models.IntegerField()
accepted = models.IntegerField()
type = models.IntegerField(default=1)
date = models.DateTimeField(primary_key = True)
time_t...
I have a set of URL's in my django application that trigger certain actions or processes. This would be similar to cron jobs. I have a script that polls one or more of these URLS at some regular inverval and I'm interested in adding a layer of security.
I'd like to set up an account for the script and require authentication before the...
I'm using
{% get_threaded_comment_tree for OBJECT [TREE_ROOT] as CONTEXT_VAR %}:
to get a list of all my comments for a specific object. This works great, but I want to get the most recent on the top of my list. By default this returns the oldest on the top of the list. Any ideas on how can I achieve this.
...
I'm using
{% get_comment_count for OBJECT as CONTEXT_VAR %}:
to get the number of comments that an object has. The issue with this is that you can't limit it by depth. I want to be able to get for example the number of comments a specific object has had excluding the replies made to the comments it self.
Any ideas on how to achieve t...
Hello ! I have a really strange problem with the standard logging module used in django views. Sometimes it works perfectly and sometimes it does not log messages.
Here is the structure of my code :
/mysite/ (Django root)
my_logging.py (logging configuration)
settings.py
views.py (global views)
data_objects.py (objects ...
Please see the code below. Basically, when the user creates an object of this class, they need to specify the value_type. If value_type==2 (percentage), then percentage_calculated_on (which is a CheckboxSelectMultiple on the form/template side needs to have one or more items checked. The model validation isn't allowing me to validate lik...
I have an application that needs to generate its models on runtime.
This will be done according to the current database scheme.
How can it be done?
How can I create classes on runtime in python?
Should I create a json representation and save it in a database and then unserialize it into a python object?
...
Hello Djangoists,
Using a decorator I was trying to add a method to WSGIRequest request, just like is_ajax().
Since I could not find a proper way I just updated request.META with the info needed.
Should I look into adding method at runtime in Python ?
...
I want to create a quiz web application using django where the quiz question will be in Bengali. How can i generate the bengali font in my desired site.
Please if anyone tell me .. i will be grateful to him
...
I would like to display some content located in my models in some of my template pages.
I am using django-page cms
In the documentation views are not used to display content. Instead ready made template tags are used.
http://packages.python.org/django-page-cms/display-content.html
I do not understand a word of this. Please Bear with ...
Hello,
I would like to be able to return a HTTP Reponse with a formated content with django-piston.
I guess I have to create my own rc_factory.
What I would like to do is :
return rc.404({'status': 0,'message': 'This restaurant does not exists.'})
With a result provide by XMLEmiter, JSONEmiter or YAMLEmiter regarding to the format ...
I am having troubles to carry over previously selected items in a ModelForm in the admin.
I want to use the forms.CheckboxSelectMultiple widget since that is the most straightforward UI in this usecase. It works as far that when saving, the values are stored. But when editing the previously saved item, the values previously saved in this...
Considering the following models, knowing a family, how do I select Kids with no buyers?
class Family...
class Kid(models.Model):
name = models.CharField(max_length=255)
family = models.ForeignKey(Family)
buyer = models.ManyToManyField(Buyer, blank=True, null=True)
family = get_object_or_404(Family, pk=1)
for_sale = family...
Django doesn't support displaying of related objects from a many-to-many relation in the changelist for a good reason. It would result in a lot of database hits.
But sometimes it is inevitable and necessary to e.g. display an object's categories, which have a many-to-many relation to the object, in the changelist. Given that case, does ...
I am trying to setup a URL redirect for a Q&A site I am setting up for Boat Repairs. I want boatrepaired.com to go to www.boatrepaired.com. I am generally a php guy so I am a bit confused with python etc. used by OSQA. I added this to my apache conf file...
<Directory /opt/OSQA/>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^...
I am trying to get the best possible set up for developing my django project from the start and I'm having trouble getting everything to play nicely in the directory structure. I have set up virtualenv's (env in this example) so that I can deploy a clean empty python environment for every django project.
The basic structure is as follow...