django

django: form.fields not iterating through instance fields

I am trying to iterate through form.fields in a template and for: {% for field in form.fields %} {{ field }}, {% endfor %} I am getting a list of the field names ("name, description...") instead of the html code that is rendered when using the following: {{ form.name }}, {{ form.description }} (the output in this case is: <in...

Django soaplib error

Hi, I'm trying to make a little "Hello World" webservice with Django following a few tutorials, but I'm hitting the same barrier over and over. I've defined a view.py and soaplib_handler.py: view.py: from soaplib_handler import DjangoSoapApp, soapmethod, soap_types class HelloWorldService(DjangoSoapApp): __tns__ = 'http://saers.d...

Django: specifying a base template by directory

I'm working on a Django site that has multiple sections and subsections. I'd like to have several depths of template inheritance: a base template for the whole site, one base template for each section that inherits from the root base template, and so on. Here's a simplified version of my desired directory structure: base.html section1/ ...

Django Custom Queryset filters

Is there, in Django, a standard way to write complex, custom filters for QuerySets? Just as I can write MyClass.objects.all().filter(field=val) I'd like to do something like this : MyClass.objects.all().filter(customFilter) I could use a generator expression (x for x in MyClass.objects.all() if customFilter(x)) but that would...

"Disabled" option for choiceField - Django

Hi, I having trouble with a simple question : How to have some "disabled" field in a dropdown menu generated via a modelForm and choiceFied in the django Framework ? At the moment, I cannot figure out how to obtain such an output : -- Root 1 entry -- (disabled) -- Elt 1 -- (not disabled) -- Root 2 entry -- (disabled) Do you have any ...

Error while deploying Django on Apache

I have a small Django website which I am trying to run on an Apache 2.2 HTTP-Server. The application is running fine using "python manage.py runserver". Django Version: 1.0.2 final Python: 2.5 OS: Windows 2000 I wen't through the steps described in the documentation and after some fiddling, came out with the following in my httpd.con...

How can I make the Django contrib Admin change list for a particular model class editable with drop downs for related items displayed in the listing?

Basically I want to have an editable form for related entries instead of a static listing. ...

Django syncdb locking up on table creation

I've added new models and pushed to our staging server, run syncdb to create their tables, and it locks up. It gets as far as 'Create table photos_photousertag' and postgres output shows the notice for creation of 'photos_photousertag_id_seq', but otherwise i get nothing on either said. I can't ctrl+c the syncdb process and I have no ind...

How to show Django auth messages only in admin interface?

Django's auth messages look pretty handy for notifying a CMS user of some configuration problem. The thing is that the messages are deleted on every page load if you include the "django.core.context_processors.auth" context processor, and you have to include that processor if you want to use the admin interface. I tried hacking around i...

How to write a Django view to obtain CharFields of multiple Django models that can only be accessed through relations

Please see the following Django models: - class Student(models.Model): reference_num = models.CharField(max_length=50, unique=True) name = models.CharField(max_length=50) birthdate = models.DateField(null=True, blank=True) is_active = models.BooleanField(db_index=True) class Examination(models.Model): short_name = ...

Eclipse + Git - what does "staged" mean?

Hello! After working for some time with SVN I decided to try git with my new django project and installed the plugin for it into eclipse. I made a new pydev project and added django initial project files to the src directory. Then I "shared" the project to Git, added and commited all files. Now I have strange problems - all files exce...

How do I set urlpatterns based on domain name or TLD, in Django?

How do I set urlpatterns based on domain name or TLD, in Django? For some links, Amazon shows url in native language based on its website tld. http://www.amazon.de/bücher-buch-literatur/ ( de : books => bücher ) http://www.amazon.fr/Nouveautés-paraître-Livres/ ( fr : books => Livres ) http://www.amazon.co.jp/和書-ユーズドブッ-英語学習/ ( ...

Creating an entire web application using django admin

I was thinking that django admin is an utility to provide trusted administrators of the site, full access to the site's data model. However, after going through django admin in detail, I understand that it is very powerful set of views and templates that one can use to create an entire application. How often do you create an entire app...

verbose_name_plural unexpected in a model?

Hi! I've been doing some models of a future app, and, after adding verbose_name and verbose_name_plural to every entry on a working model, for making it 'beautiful', I've found that at validate time, Django doesn't like that, so it says: File "/home/andor/Documentos/desarrollo/grundymanage/../grundymanage/concursantes/models.py", lin...

Using 'old' database with django

I'm using a hand built (Postgres) database with Django. With "inspectdb" I was able to automatically create a model for it. The problem is that some tables have multiple primary keys (for many-to-many relations) and they are not accessible via Django. What's the best way to access these tables? ...

Specifying different template names in Django generic views

Hi, I have the code in my urls.py for my generic views; infodict = { 'queryset': Post.objects.all(), 'date_field': 'date', 'template_name': 'index.html', 'template_object_name': 'latest_post_list', } urlpatterns += patterns('django.views.generic.date_based', (r'^gindex/$', 'archive_index', infodict), ) So going to the address /gindex...

Fill Django application with data using very large Python script

I wrote a program that outputs a Python program that fills my Django application with data. This program however is 23 MB large and my computer won't run it. Is there a solution for this? Another possible solution to fill the database would be using a fixture. The problem is that I don't know the new primary keys yet... or I would have ...

Does any one know of an RTF report generator in Django?

I know about the PDF report generator, but I need to use RTF instead. ...

What's the best way to have different profiles for different kinds of users in django?

In my application I have students, professors and staff. Staff members do not need a profile but professors and students each need a different profile. I'd rather not implement it all myself (middleware and whatnot), so is there anyway to just have get_profile() return a different profile depending on a user's role? ...

Select Distinct Years and Months for Django Archive Page

I want to make an archive_index page for my django site. However, the date-based generic views really aren't any help. I want the dictionary returned by the view to have all the years and months for which at least one instance of the object type exists. So if my blog started in September 2007, but there were no posts in April 2008, I cou...