I have a queryset in Django that calls Model.objects.values('item')... where 'item' is a Foreign Key.
class Words(models.Model):
word = models.CharField()
class Frequency(models.Model):
word = models.ForeignKey(Words)
...
So this returns the item id and displays as an id in the template. How do I show the actual item value in ...
I have a django app, and on the backend I've got a many to many field that I've set in the 'raw_id_fields' property in the ModelAdmin class. When running it locally, everything is fine, but when I test on the live site, the link to the lookup popout window doesnt work.
The django app resides at example.com/djangoapp/ and the admin is e...
My company is looking to move their software to an open source framework. Their first thought was J2EE. I know that Django and Rails are popular for recreational development, but not sure about them in a corporate setting.
I was looking to compile a list of possible web frameworks to consider. Unfortunately I am not able to release ou...
How do people deploy/version control cronjobs to production? I'm more curious about conventions/standards people use than any particular solution, but I happen to be using git for revision control, and the cronjob is running a python/django script.
...
I am sure that someone has a pluggable app (or tutorial) out there that approximates this, but I have having trouble finding it: I want to be able to track the number of "views" a particular object has (just like a question here on stackoverflow has a "view count").
If the user isn't logged in, I wouldn't mind attempting to place a cook...
I have a Django app where most of the search is driven by foreign keys. For example, assuming Student, School, State, and EducationalQualification are Django models, the user would search for Students by specifying search criteria by selecting from lists of Schools, States, Degrees, Diplomas etc. That is, a search on students is essenti...
My models:
Story:
categories = models.ManyToManyField(Category)
Category: name | slug
My urls:
(r'^(?P<cat_slug>.*)/$', 'news.views.archive_category'),
And in views, I use:
def archive_category(request, cat_slug):
entry = News.objects.get( categories__slug=cat_slug )
return render_to_response('news_archive_category.html...
A site in Vietnamese, it is virtually no different to English. However, there is a problem that is slug. When I type characters such as "ư", "ơ", "á",... Django is not identified. Solution here is to replace characters that do not sign into.
Eg:
ư -> u
ơ -> o
á -> a
One from "những-viên-kẹo" will become "nhung-vien-keo".
However,...
I have a file called header.html and it is included by base.html. In header.html, I have a list of Categories, which are stored in the database. Now, I want to give that list to header.html. The problem is that no function is known to render the data into this file. So how do I do now. Heartfelt thanks!
...
Hello,
I have recently updated my model, added a BooleanField to it however when I do python manage.py syncdb, it doesn't add the new field to the database for the model. How can I fix this ?
...
django.utils.translation.get_language() returns default locale if translation is not activated. Is there a way to find out whether the translation is activated (via translation.activate()) or not?
...
I'm playing around with django and built a small app where a user can access their info via the url http:///localhost:8000/username/info/ . I want to add the ability to edit that info through http:///localhost:8000/username/info/edit/, but also want to make sure the currently logged in user (using django.contrib.auth) can access only his...
Hi all,
I need to show a user only the objects that he owns. Since I need to do this on more then 80% of my views, hardcoding this kills DRY. More so, it is absolutely imperative that a user never sees records owned by others. And doing it by hand (in all the views) also seems error prone.
I've been looking at decorators (like login_re...
How do I install a Django snippet, in particular snippet 818 - dumpscript, on Linux?
Update 2. The question was about Linux, but for reference I have listed the corresponding way to install dumpscript on Windows below, e.g. for use during development. (But it can also be done the other/standard way if there are no file access restrictio...
I'm mapping an existing database structure into Django models. I have a many-to-many structure where the association table is natural-keyed:
CREATE TABLE foo (id INTEGER PRIMARY KEY);
CREATE TABLE bar (id INTEGER PRIMARY KEY);
CREATE TABLE foo2bar (foo_id INTEGER REFERENCES foo(id),
bar_id INTEGER REFERENCES bar(id...
I've been working on my own django based blog (like everyone, I know) to sharpen up my python, and I thought added some syntax highlight would be pretty great. I looked at some of the snippets out there and decided to combine a few and write my own syntax highlighting template filter using Beautiful Soup and Pygments. It looks like this:...
Hi - I'm trying to redirect a user to a url containing his username (like http://domain/username/), and trying to figure out how to do this. I'm using django.contrib.auth for my user management, so I've tried using LOGIN_REDIRECT_URL in the settings:
LOGIN_REDIRECT_URL = '/%s/' % request.user.username # <--- fail..
but it only seems t...
I've recently implemented sitewide caching using memcached on my Django application, I've set the TTL to about 500 seconds, and implement per view caches on other parts of the web application.
The problem I have is that when a user logs out, because it's a form post the site behaves as expected, however if they then go to a password pro...
I am attempting model inheritance on my Django powered site in order to adhere to DRY. My goal is to use an abstract base class called BasicCompany to supply the common info for three child classes: Butcher, Baker, CandlestickMaker (they are located in their own apps under their respective names).
Each of the child classes has a need fo...
I'm trying to filter the User list in Django using a UserProfile Field... I need to implement a queue system where new users are put in a queue until an Admin approves them.
I simply added a is_in_queue boolean field to my UserProfile model... However, when displaying the user list in my Admin area, I realized that you can't filter the ...