Hi
i have a following solution structure in python:
main_app
main_app/template_processor/
main_app/template_processor/models
main_app/template_processor/views
everything works just fine on my local machine. as soon as code gets to server (it stopped working after i removed all .pyc files from svn), it doesn't see the assembly (if it...
My application uses class inheritance to minimize repetition across my models. My models.py looks kind of like this:
class BaseModel(models.Model):
title = models.CharField(max_length=100)
pub_date = models.DateField()
class Child(BaseModel):
foo = models.CharField(max_length=20)
class SecondChild(BaseModel):
bar = models...
I would like to bundle up css and javascript files. I also want to send far-future expire headers to clients, so I need file versioning.
A quick search across the Internet has shown there are several asset managers developed for Django. Here is a list of those that I could reach:
django-compress
django-assets
django-assetpackager
dja...
Is there a way to specify a value from a list of one-to-many models at Django's Template?
For example I can do this in the shell: author.book_set.get(publisher=my_publisher). However I want something like that in my template. I'm only passing Authors, a list of Author and publisher to the template.
Models:
class Publisher(models.M...
I have this simple setup:
class Artist(Model):
...
class Download(Model):
artist = ForeignKey(Artist)
title = CharField()
file = FilePathField(...)
and the admin looks like this:
class DownloadInline(TabularInline):
model = Download
class ArtistAdmin(ModelAdmin):
inlines = [DownloadInline,]
I get a validation error fo...
For developing our Django web app, I'd like to move to an autonomous system that automatically updates the source (from VCS) of a staging copy of the app which has near identical properties to the live version of the application. The general idea of doing this has already been covered here on SO #625256. The Django documentation also t...
Let's say I have this model:
class Foo(models.Model):
bar = models.ForeignKey(Bar)
currency = models.ForeignKey(Currency) # currency is just an example
is_active = models.BooleanField()
Now suppose Foo is an Inline of Bar. And I would always want to indicate a value on each currency? If I could replace those currency drop ...
I have the following ModelForm:
class AttendanceForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
operation_id = kwargs['operation_id']
del kwargs['operation_id']
super(AttendanceForm, self).__init__(*args, **kwargs)
self.fields['deployment'].query_set = \
Deployment.objects.filt...
Hi all
In the Django admin, the user can set filters which limit the rows displayed in the change list. How can I get a QuerySet instance with filters set as defined by the query string? For instance, if I pass ?start_date_gte=2009-11-06, the Django admin will apply a qs.filter(start_date__gte...) somewhere. How can I access such a Quer...
My DjangoApp is using categories to generate a navigation and to put stuff in those categories.
There are two types of categories:
ParentCategories (top categories)
ChildCategories (sub categories that have a ParentCategory as a parent)
Because those to categories are so similar I don't want to use two different models.
This is my c...
I would like to profile a custom management command that is relatively CPU intensive (renders an image using PIL). When I use the following command I get all sorts of Django modules (admin, ORM etc) in my profiling results:
python -m cProfile manage.py testrender
I have removed all imports that can potentially import Django but I am g...
I have a sort of unique situation....I want to populate a ModelChoiceField based of several tables, reason being I want to have the search containing only active records. An example of one of the models is as follows:
class ExteriorColour(models.Model):
exterior_color = models.CharField(max_length=7, blank=False)
def __unicode__(...
I am trying to install sorl.thumbnail but am getting the following error message:
'thumbnail' is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module named PIL
This error popped up in this question as well
http://stackoverflow.com/questions/1356334/need-help-solving-sorl-thumbnail-error...
I'm adding a set of template tags to a Django application and I'm not sure how to test them. I've used them in my templates and they seem to be working but I was looking for something more formal. The main logic is done in the models/model managers and has been tested. The tags simply retrieve data and store it in a context variable ...
So I've been building django applications for a while now, and drinking the cool-aid and all: only using the ORM and never writing custom SQL.
The main page of the site (the primary interface where users will spend 80% - 90% of their time) was getting slow once you have a large amount of user specific content (ie photos, friends, other ...
I have a contact/address app that allows users to search the database for contact entries. The current view will return an object (Entry()) and display its fields. The code is as follows:
def search_page(request):
form = SearchForm()
entrylinks = []
show_results = True
if request.GET.has_key('query'):
show_resu...
Hi, everyone!
I'm trying to figure out how to show something like "Showing 1-10 of 52" using django pagination in my templates.
I accomplished the pagination itself but nothing comes to my mind about this requirement.
Any ideas?
...
I was just pondering if make two named urls the same produces any problems. I tried it and it works.
So for example, I have a view that is able to do paging:
def info(request, page_num = 1)
and I would like to call it both ways, as:
/info
/info/page/1
so I made urls like:
url(r'^info/$', 'views.info', name='info'),
url(r'^info/(?P...
We've got some clients sending a custom POST of a data blob to our django servers.
They do things in a rather funky way that I'd rather not get into - and we've since moved on from making that particular format the norm. To make further implementations of our upload protocol more streamlined, I was looking to roll a custom UploadHandl...
I have several objects with some functions that I would like to be able to run via the admin panel. So far, I've not found a way to add them as actions to the admin interface.
Is there a way to do it?
...