Weird django URL problem.
If i go to www.mysite.com/login, everything displays like it should. But when i want to go from mysite.com/login to mysite.com/register, i end up in mysite.com/login/register. How can i solve this problem? ...
If i go to www.mysite.com/login, everything displays like it should. But when i want to go from mysite.com/login to mysite.com/register, i end up in mysite.com/login/register. How can i solve this problem? ...
# admin.py class CustomerAdmin(admin.ModelAdmin): list_display = ('foo', 'number_of_orders') # models.py class Order(models.Model): bar = models.CharField[...] customer = models.ForeignKey(Customer) class Customer(models.Model): foo = models.CharField[...] def number_of_orders(self): return u'%s' % Order.o...
I've worked with XAMPP, WAMPP, MAMPP, etc and am starting to look at Django. A majority of the work we do is very CMS orientated; although we've been told not to use third-party CMS' (mainly because of user's find them hard to use, and other issues), I've found that I can code a very simple CMS using Cake, CodeIgniter or one of the othe...
I am evaluating using CouchDB in my new Django-project. Is there a good database backend in Django for CouchDB? I have tried searching but the projects that turn up seems very small and/or old and I can't make out what parts are solved regarding QuerySets, Auth, Sessions etc. Any help would be greatly appreciated. ...
def hi_guys(): question=" I have a django application and a php script. I want that php script interacts with the tables used by django ( with INSERT and DELETE ). Are there problems with django ? Thanks <:-)" print question ...
I have a Django project that works fine with the development server that comes with it. No errors are produced at all when I use "django manage.py runserver" and the app works fine, but when I try to use it with mod_wsgi and Apache the browser displays "Internal Server Error" with a 500 error code and it generates an import error in t...
I have the data stored in a format different from the display format. I've already worked out the form-to-db conversion in the clean_weight() method of the form, this gives me access to properly format data before saving it. Now I pretend to manipulate the instances weight before the form is displayed but I fail to see a good place to...
I've read the similar question on adding tags to a Django Blog model, where it mentions maintaining tags on the article as a StringList and a separate object to keep a count of these objects, which is good because I'd basically come up with the same idea myself, however I'm struggling to work how how to maintain the count. I'm overridin...
So I'm trying to get rich text to work for the cheeserater program where I added a commenting system using the tinyMCE editor in the textarea. This is what it looks like: <table><td align=left> {% get_comment_list for package as comment_list %} {% for comment in comment_list %} {{ comment.comment|safe }}<br> {% endfor %} </table> ...
I'm using python-memcached 1.45 with python 2.5.2, django 1.0.4, spawning 0.9.2, eventlet 0.9.3 and libevent 1.3 on 64bit debian lenny. spawning server is started with parameters given below: /usr/bin/python /usr/bin/spawn --factory=spawning.django_factory.config_factory myproject.settings \ --port=8006 --processes=1 --threads=0 --st...
I'm trying to create a basic template to display the selected instance's field values, along with their names. Think of it as just a standard output of the values of that instance in table format, with the field name (verbose_name specifically if specified on the field) in the first column and the value of that field in the second colum...
I have such model: class Body(models.Model): point = models.TextField() description = models.TextField(blank = True) order = models.IntegerField(default = 0, blank = True) When I am adding in django admin interface a new record I am getting 'NoneType' object is not callable with TemplateSyntaxError message. So, record i...
So I have an app called stats that lets me query my database in various ways and return information in a JSON format so I can have a nice ajaxy dashboard for graphing and visualizing. I'd like this app to be as reusable as possible, naturally, so I don't want to necesarily use the @login_required decorator on its views. In my case, how...
Is there a way to extend another apps ModelAdmin? I have a project that uses functionality offered by django.contrib.comments. The CommentsAdmin ModelAdmin class has: actions = ["flag_comments", "approve_comments", "remove_comments"] I would like to extend the CommentsAdmin ModelAdmin in my project to include an action ban_user. I've...
For a model like: class Item(models.Model): notes = models.TextField(blank=True) .... I'm attempting to do a simple queryset for all Items where the "notes" field is non-empty. Not finding mention of this capability in the docs, but via a comment on a bug report, discovered that you can actually compare with greater than: ite...
I'm creating a "Q & A" website. On the questions page all of its answers could be seen (with pagination). I need to go straight down to answers (in the page) from other pages as well. I've tried implementing named anchors but unable to direct to page section. Answer's get_absolute_url() returns url in the form: www.example.com/question...
from django.db import models from djangosphinx import SphinxSearch # A sample model from iBegin class City(models.Model): name = models.CharField(max_length=32) aliases = SeparatedValuesField(blank=True, null=True)#<-------this slug = models.SlugField(blank=True) country = models.For...
I'm looking for a Django tree library and doing my best to avoid Nested Sets (they're a nightmare to maintain). The cons of the adjacency list model have always been an inability to fetch descendants without resorting to multiple queries. The WITH clause in Postgres seems like a solid solution to this problem. Has anyone seen any perfo...
I'm building a simple app, a sort of project/tasks manager where I can have several projects and several tasks that are assigned to one project. I enabled Django admin for all this sort of tasks and it's working like a charm. Also, I have some users that have projects assigned to them. So what I want now is to enable a cut down version ...
Hi! I've a problem with django csrf middleware... when I use the template tag csrf_token I get this output: <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='6bda3605af31dd8595d2a67d0dda827b' /></div> but I want this output (HTML not xHTML: <div style='display:none'><input type='hidden' name='csrfmiddle...