django

I change Python code, but can't see results

Hello for everybody. Sorry for totally stupid question, but the situation is that I have to make some changes to the Django website, and I have about zero knowleges in python. I've been reading Django docs and found out where to make changes, but there is very strange situation. When I change view, template, config or anything on web si...

Django model filters stored in database

I'm working with content types in feincms. And I want to make a content type that can store filters in the database. Roughly it would look like this: from news.models import Entry class NewsContent(models.Model): filter = models.CharField() exclude = models.CharField() offset = models.IntegerField() limit = models.Intege...

How to add a custom method to Django's Admin Console?

Ok, so in our employee database, we keep a list of all employees and we get this information contained within a data file that is produced by our HR system. The script to truncate the table and populate it with the employee information is done and works nicely. However, I would like the method call to do this from within the application....

Running Django in Virtualenv using Apache with Mod_Python and Multiple Python installations

I would like to run a Django project on a server using virtualenv in Apache using mod_python. Now I know that the recommended apache module to use is mod_wsgi, but I don't want to install that for now. The default python installation on the server is python2.4, which is used by some other website on the server. Because my project was bu...

How wrap a FormWizard in a View?

How do I wrap a Django Form Wizard in a view? I need to do this so I can access request. Does anyone have some example code for this? ...

how to modify the django admin urls?

Hi all, So i have a page with the following url format: http://tld/admin/main/report/, and i would like to pass a get request to the end to filter the queryset: ?q=+2 is all of my report for example. In the ReportAdmin(ModelAdmin), when overriding queryset(self, request), inside that, i'd like to do request.GET.get('somevar'), but the s...

How to best organize the rules component of a Django system?

I'm designing (and ultimately writing) a system in Django that consists of two major components: A Game Manager: this is essentially a data-entry piece. Trusted (non-public) users will enter information on a gaming system, such as options that a player may have. The interface for this is solely the Django admin console, and it doesn'...

Django Direct_to_template or flatpages

Ok, fairly new to Django so bare with me. Building a django app with some mostly static pages at the front of the site e.g. about.html faq.html that kind of thing I was looking at how urls.py work and I created this. ('(.+\.html)$', direct_to_template), It seems to do exactly what I needed. Now for any new .html page I add to the r...

django extends issue on appengine

hello all, i have put a copy of Django-1.2.1 in my appengine app [sys.path.insert(0, 'Django-1.2.1.zip')] and it works fine. in a webapp Class I have: name = 'dashboard' template_values = { 'name': name } fp = open('templates/dashboard.html') t = Template(fp.read()) fp.close() self.response.out.write(t.render(template_values)) ...

Django: How to 'scrub' list of users

This is my code that fails: dashboard = Dashboard.objects.get(slug=slug) users = User.objects.all() # list of users for editor in dashboard.dashboardeditor_set.iterator: users.remove(editor.user) The error: 'instancemethod' object is not iterable From models.py: class DashboardEditor(models.Model): dashboard = models.Foreig...

Django maximum recursion depth exceeded

I'm building a small web project using Django that has one model (Image) that contains an ImageField. When I try to upload an image using the admin interface I am presented with this problem (personally identifying information removed): RuntimeError at /admin/main/image/add/ maximum recursion depth exceeded Request Method: POST Re...

django: admin.StackedInline show full name instead of user name

my inline: class CollaboratorInLine(admin.StackedInline): model = Collaborator extra = 0 my model: class Collaborator(models.Model): report = models.ForeignKey(Report) collaborator = models.ForeignKey(User, limit_choices_to={'groups__name':u'team1'}) def reutnName(self): return self.collaborator.get_full_n...

TemplateSyntaxError while moving from django 1.1 to 1.2.1

I am moving my Django app from v1.1 to v1.2.1 However I am stuck on a TemplateSyntax error as seen below. I have not made any other changes to my app TemplateSyntaxError at / Caught ImportError while rendering: No module named urls None of my url reverses in the template seem to work. Here is the culprit line: <a href="{% url myapp...

Django: Managing Session Variables to manage the browser back button

I am creating a web based Mock test paper, which needs to be fairly secure. The needs are Each question can be attempted and answered just once. All are multiple Choice questions Once a question is answered and the submit pressed, then that session must expire, and the same question must not appear either through back button or some o...

django login authentication

I'm relatively new to django.. In the app that I'm building, there are multiple types of users (ie User1, User2, User3) that are all inheriting from django.contrib.auth.models.User and upon login, each user should be redirected to a success page depending on what type of user they are. In views.py: def login_attempt(request): user = ...

Refactoring Index/Search View

I've written an index and search view all in one if a GET request is detected it returns just the search results otherwise it returns all records. I've written this view below but I feel like I'm repeating myself a bit too much. Any ideas as to how I can slim this code down a bit would be much appreciated. def index(request): if 'q'...

URL template tags fail in Test mode, but work in Dev and Production ( Django 1.2.1 )

I've been trying to add the django-lean app to my project. I have not been able to get the tests to pass. It took me a few days with a debugger to determine what the problem was. It seems that all the URL template tags fail in Test mode, but not in Production nor Developement. Failure happens in django.template.defaulttags.URLNode.ren...

In Django, how do I select 100 random records from the database?

myqueryset = Content.objects.filter(random 100) ...

Django admin and MongoDB, possible at all?

I'm building a simple short URL service, ala bitly, for our company use. And I would like to use mongodb to store the data, but I will need some kind of simple interface to add/edit short url to long url mappings. The mongo documents will be very simple, something like this: { shortUrlSlug: 'pbbs', fullUrl: 'http://example.com/pean...

Make Django Admin remember my parameters after posting

Hi! I have a problems thats been bugging me for a while. I want to use dates in django admin to view entries between certain dates. To do this I have customized my changelist.html for this model and put a form in there. When posted I override the queryset method like this def queryset(self, request): qs = super(ModelAdmin, self).q...