django

Sinatra Web Admin (like Django Admin)

Is there a way to get a Django Admin style web-admin for Sinatra? ...

Date filter: wrong format

I have this field in my Post model: created = models.DateTimeField(_('created'), default=datetime.now) In my template I have this: {{ post.created|date:"SHORT_DATE_FORMAT" }} I my settings.py I have this: LANGUAGE_CODE = 'it' USE_L10N = True But I get this: th03-0500RCDT_marAMCDTE_maggio-0500RMagAMCDT Why ? This is the docum...

Django: How do I prepend

Hello, I'm exploring Django and got this particular problem. How do I prepend <span class="label">Note:</span> inside {{article.content_html|safe}}? The content of {{article.content_html|safe}} are paragraph blocks, and I just wanna add <span class="label">Note:</span> in the very first paragraph. Thanks! ...

Python (Django). Store telnet connection

Hello. I am programming web interface which communicates with cisco switches via telnet. I want to make such system which will be storing one telnet connection per switch and every script (web interface, cron jobs, etc.) will have access to it. This is needed to make a single query queue for each device and prevent huge cisco processor ...

Using Django with mod_wsgi

When you use Django with mod_wsgi, what exactly happens when a user makes a request to the server from a browser? Does apache load up your Django app when it starts and have it running in a separate process? Does it create a new Python process for every HTTP request? ...

Django-cms problem

I'm setting up a website using django-cms and when I open up the add page view in the admin, I get this error: TemplateSyntaxError at /admin/cms/page/add/ Invalid block tag: 'csrf_token' What could be the problem? I'm using Django 1.1. BTW. ...

Is it possible to use Django's testing framework without having CREATE DATABASE rights?

Since I don't have a hundred bazillion dollars, my Django app lives on a shared host, where all kinds of crazy rules are in effect. Fortunately, they gave me shell access, which has allowed me to kick butts and take names. However I can't do anything about not having CREATE DATABASE rights. I'm using postgresql and have a killer test su...

How to get a single widget to set 2 fields in Django?

Hi, I got a model with 2 fields: latitude and longitude. Right now they're 2 CharFields, but I want to make a custom widget to set it in admin - was thinking about displaying Google Maps, then getting the coordinates of the marker. But can I have 1 widget (a single map) to set 2 different fields? ...

Adding links to full change forms for inline items in django admin?

I have a standard admin change form for an object, with the usual StackedInline forms for a ForeignKey relationship. I would like to be able to link each inline item to its corresponding full-sized change form, as the inline item has inlined items of its own, and I can't nest them. I've tried everything from custom widgets to custom te...

Django Inlines user permissions + view only - permissions issues

I'm not sure if this is a bug or I'm just missing something (although I have already parsed the documentation about inlines), but: Let's say I have a model A. Model A is an inline of model B. User U has full access to model B, but only change permissions to model A (so, no add, nor delete). However, when editing model B, user U can sti...

Please clear up this django query question

Hi, I have developed a few Django apps, all pretty straightforward in terms of how I am interacting with the models. I am building one now that has several different views which for lack of a better term are "canned" search result pages. These pages all return results from the same model, but they are filtered on different columns. One...

Django - Better evaluation of relationship at the model level

Here's a simple relational pair of models. class Shelf(models.Model): name = models.CharField(max_length=100) def has_books(self): if Book.objects.filter(shelf=self): return True else: return False class Book(models.Model): shelf = models.ForeignKey(Shelf) name = models.CharField(max_length=100) Is there ...

Difficulties with Django on Google App Engine

I have a Django 1.1.1 project that works fine. I'm trying to import it to Google App Engine. I'm trying to follow these instructions. I run it on the dev server, and I get an import error: ImportError at / No module named mysite.urls This is the folder structure of mysite/: app.yaml <DIR> myapp index.yaml main.py manage.py...

Django | Models where clause

How to construct a where clause using Django models: insert in to tablename where email=emailaddress Thanks. ...

django/ruby on rails is community or enterprise based

i wonder if django has a community or an enterprise behind it for devlopement? the same with rails. thanks! ...

How do I subtract two dates in Django/Python?

Hi! I'm working on a little fitness tracker in order to teach myself Django. I want to graph my weight over time, so I've decided to use the Python Google Charts Wrapper. Google charts require that you convert your date into a x coordinate. To do this I want to take the number of days in my dataset by subtracting the first weigh-in from...

How do I reference Django Model from another model

Im looking to create a view in the admin panel for a test program which logs Books, publishers and authors (as on djangoproject.com) I have the following two models defined. class Author(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = models.EmailField() d...

Lighting Fast CMS, a Django based CMS. Any experiences?

I've just came across Lighting Fast CMS, which seems to be very promising Django based content management system. Documentation seem to be very good, even though it is still in beta stage. It also has very nice buildout based installation. Also the core Components of it seem to be nicely decoupled. Does anyone have any experiences wit...

How do I create sub-applications in Django?

I'm a Django newbie, but fairly experienced at programming. I have a set of related applications that I'd like to group into a sub-application but can not figure out how to get manage.py to do this for me. Ideally I'll end up with a structure like: project/ app/ subapp1/ subapp2/ I've tried: manage.py startapp app.su...

Easiest way to rename a model using Django/South?

Hi everyone, I've been hunting for an answer to this on South's site, google, and SO, but couldn't find a simple way to do this. I want to rename a Django model using South. Say you have the following: class Foo(models.Model): name = models.CharField() class FooTwo(models.Model): name = models.CharField() foo = models.Fo...