django

Extending Django-Admin Login (username, password, sites)

Hi, I'm trying to extend Django Admin Login. Most of the resources pointed towards extending views after the Login. I wanted to add sites to the Login criteria. So instead of Username Password It will be Username Password Site Such that the Site will check whether the user belongs to the Site as admin and if it is, it will l...

Django: output aggregation of aggregation ordered by counts

I'm trying to output the following data in my django templates. Countries would be ordered descending by # of stories. Cities would be ordered descending by # of stories (under that country) Country A(# of stories) City A (# of stories) City B (# of stories) Country B(# of stories) City A (# of stories) City B (# of stories) ...

Highlighting days in calendar widget

I'm using the django admin calendar widget and would like to do highlight specific dates within the widget for display. Is there a way to do this with the built-in django calendar widget? Or, is there recommended widget that could be incorporated into a django project for this purpose? ...

Could not parse the remainder

i want to compare num and {{buildSummary_list.number}}, but why it is not work? And i got an error "Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"... {% for num in buildSummary_list.paginator.page_range %} {% ifequal num {{buildSummary_list.number}} %} <b>{{num}}</b> {%...

Django db Table delete

With what command can i delete tables from a django db of a specific app/ only one table? I did find all sorts of things, but not how to get rid of a table. Also while I am at this. I create the models and hit syncdb and then I have the tables. If I want to update/add to those tables, do I run into problems? Thanks! ...

jquery django button

I would like to create a button that records date and time in the browser, when the user clicks it and then send that information to a django db. 1.db part: Would the db field I save it to best be a DateTimeField() or a CharField()? I want the exact date and time of that button clicked? jQuery part: I heard (here) that jQuery can acco...

What is the internal function in django to add new tables to a queryset in a sensible way?

In django 1.2: I have a queryset with an extra parameter which refers to a table which is not currently included in the query django generates for this queryset. If I add an order_by to the queryset which refers to the other table, django adds joins to the other table in the proper way and the extra works. But without the order_by, th...

Linux as a guest on MacOS X: VirtualBox or Parallels?

I'm going to develop mostly Django sites on a MacBook Pro and would like to use Ubuntu VMs for testing purposes. Which product is better suited for this purpose? Can I connect to the VM via TCP/IP (so I can have apache running on the VM and access it from Safari on my MBP)? Thanks! ...

Tuple Choices Django

If I have a GENDER_CHOICE Tuple in a model like so: GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) Could I use Integers a swell: GENDER_CHOICES = ( ('1', 'Male'), ('2', 'Female'), ) And have a IntegerField(max_length=1) to write to ? Thanks. ...

Django - dreaded 'iteration over non-sequence'

Hi I'm looking to populate a list of members, based on where their club comes from. This is my code: members = [] if userprofile.countries.count() > 0: for c in userprofile.countries.all(): clubs = Club.objects.filter(location__country = c) for club in clubs: members_list = Member.objects.get_membe...

django templates html

Hi guys, I've two different views (for instance, one for colors and other for cars ) That views point to the same template. If you click in one color, the template will show all the information about the color selected, same thing whit the car. What I'm trying to do is to insert a button to go back: <form action=""> {% ifequal back_t...

How do i render a template inside another template?

Hello, I'm new in Django and Python and I'm stuck! It's complicated to explain but I will give it a try... I have my index.html template with an include tag: {% include 'menu.inc.html' %} The menu is a dynamic (http://code.google.com/p/django-treemenus/). The menu-app holds a view that renders menu.inc.html: from django.http import...

Google App Engine pros\cons for Django?

I'm about to start a new django project with friends. This project includes a website, API to mobile applications, clearing and billing, internationalization aspects etc... What are the pros and cons for using Google App Engine vs. a regular web hosting solution? Of course GAE documentation praises their support for django, but I would...

What is the status of DJango Row based permission?

Is it DJango Row Level Permission ready to use in application development? Or is it just a hook so far, that require third party component to work properly? As of DJango 1.2, syncdb didn't create any special tables/fields to handle Row Level Perimission. If not available, what is the best dependable implementation available as open sou...

model django new tables

I just created all the db tables from one model with 6 classes. In on of them I would like to add a NEW field I did that and hit: python manage.py syncdb But Django wont add that column in that table. Am I missing something? How can i add columns/tables AFTER I already created the db in Django. Thanks ...

django increase inactivity timeout

If I am logged into my Django site but am inactive for a while it automatically logs me out. Is there a way to stop this all together or at least increase the timeout to say an hour or so? ...

What's the best way to handle different forms from a single page in Django?

Let's say I have the 3 different forms defined in my view: # views.py form_one = FormOne() form_two = FormTwo() form_three = FormThree() In my template: <form action="" method="post" id="form-one"> {{ form_one.as_table }} <input type="submit" value="Submit Form One" name="form-one" /> </form> <form action="" method="post" id="fo...

Loading inline objects using ajax in django admin.

I have a setup where I can upload many pictures at once inline and it looks like this: This works perfectly. And I can also reorder them with jquery sortable Here is the related code so you see what's happening: class PhotoInline(admin.StackedInline): model = Photo extra = 0 form = PhotoModelForm fieldsets = ( ...

south django migrate

I installed south and I try to use it to migrate now: ./manage.py schemamigration myapp --initial I get a : -bash: ./manage.py: Permission denied and if I sudo I get: sudo: ./manage.py: command not found Response. Whats wrong? Thanks! ...

Using arbitrary methods or attributes as fields on Django ModelAdmin objects?

Using Django 1.1: The Django admin docs describe using arbitrary methods or attributes on a ModelAdmin object in the list_display class attribute. This is a great mechanism for displaying arbitrary information in the list display for a Model. However, there does not appear to be a similar mechanism for the change form page itself. What ...