django

Nested inlines in the Django admin?

Alright, I have a fairly simple design. class Update(models.Model): pub_date = models.DateField() title = models.CharField(max_length=512) class Post(models.Model): update = models.ForeignKey(Update) body = models.TextField() order = models.PositiveIntegerField(blank=True) class Media(models.Model): post = mode...

Use Django flatpages without sites

Is there any that I can have a catch all site with flatpage framework in Django? I have one site but you can get to it through a few DNS names that change constantly. I need to map these all to a single site and flatpages seems bent on me pre-specifying my domain entries. ...

Django South removes foreign key REFERENCES from SQLite3 schema. Why? Is it a problem?

When using syncdb the following schema is created: CREATE TABLE "MyApp_supervisor" ( "id" integer NOT NULL PRIMARY KEY, "supervisor_id" integer NOT NULL REFERENCES "MyApp_employee" ("id"), "section_id" integer NOT NULL REFERENCES "MyApp_section" ("id") ); When using migrate, it is changed to: CREATE TABLE "MyApp_superviso...

Django, how to update fields in a model without creating a new record?

I have a model in django that I want to update only, that is, when I call it and set the data, it will not create a new record, only update the existing one. How can I do this? Here is what I have: class TemperatureData(models.Model): date = models.DateTimeField() value = models.PositiveIntegerField() alert = models.Boole...

python django database synch

I use django in project. I have many cron jobs which operate with database. I want to replace cron jobs on other machine and synchronize processed data with main server. But my host provider doesnt allow external connections to db. How to organize sync. best way? I know what i can pass it via POST request with my own written protocol, bu...

Does python manage.py runserver use paster as the server?

A little confused, does python manage.py runserver use the paster web server or is this a django specific server? ...

Django models.py Circular Foreign Key

I have a django app which basically is just a photo album. Right now I have two models: Image and Album. Among other things, each Album has a foreign key to an Image to be its thumbnail and each Image has a foreign key to the Album it belongs in. However, when I try to use manage.py syncdb or manage.py sqlall I get errors saying the clas...

django deleted row exists?

I am facing a very peculiar problem that even when I delete some rows, I can just get them back again in same transaction. I am running this under apache and mod_wsgi, database is mysql. Edit: I have created a sample app to test it out, so that I can be sure that none of my code is culprit. I created a testapp with following code mode...

how to query ManyToMany

class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) A1=>[P1,P2] A2=>[P2,P3,P4] How to get a queryset in all of the [P1,P2,P3,P4] Article.all().publications....

Deletion of a particular record in django

If a model exist like class Empprofile(models.Model): name= models.CharField(max_length=255) group = models.CharField(max_length=255) description = models.CharField(max_length=1024) class Details(Empprofile): address1=models.CharField(max_length=255) address2=models.CharField(max_lengt...

How to display milliseconds instead of microseconds with Django

In Django template language I can display a time with microseconds using : {{ player.time_to_display|time:"i:s:u" }} I would like to display only milliseconds instead of the full microsecond value. I am not able to locate a way to do that in the documentation, is there a simple mean to do that ? ...

[Fun riddle] Any clue on this error with generic relation using Django Orm?

This is a fun one :-) Working on an EAV, we inject a generic relationship handler at runtime in a model. model_cls is any class, and a EavValue class have a generic relation pointing to it. It works fine from EavValues to a model_cls, but on the other way we need to inject an accessor to ease things: generic_relation = generic.Generic...

Django - Multiple columns primary key

Hello, I would like to implement multicolumns primary keys in django. I've tried to implement an AutoSlugField() which concatenate my columns values(foreignkey/dates) ... models.py : class ProductProduction(models.Model): enterprise = models.ForeignKey('Enterprise') product = models.ForeignKey('Product') date = models.Dat...

How hard is it to learn Python/Django for a JEE dev?

I was wondering is learning Python and Django a hard/time consuming process for someone who's already rather familiar with OO programming (C++/Java) and some web dev (JEE)? I'm starting to look for a technology to implement a part of my master's thesis and since it will be a web app I'm considering JEE (since I'm already familiar with it...

Anyone using mongoengine with Django auth

I am quite new to both django and mongoengine. Is there any project I can refer to see basic implementation of user authentication and authorization. ...

pisa to generate a table of content via html convert

Dear, Does anyone have any idea how to use the tag so the table of content comes onto the 1st page and all text is coming behind. This is what i've got so far, it generates the table of content behind my text... pdf.html <htmL> <body> <div> <pdf:toc /> </div> <pdf:nextpage> <br/> <h1> test </h1> <h2> second </h2> some text...

"Last" tag not working

I have a queryset of "promotion" events which are rendered in a template. Each of these promotions also have 1 or more appointments. What I want to do is display the dates of the first and last appointments. So far, using the "first" tag works. However, using the "last" tag causes: TemplateSyntaxError Exception Value: Caught an e...

Google Calender API for Django?

Hi all, I was wondering if any one of you have tried implementing Google Calender API on Django? any libraries to recommend? What's your experience in using them? ...

WTForms extension for Django templates not working

I feel like I am missing something really obvious. I'm trying to use the WTForms template extensions with Django. I have a project on my development server which is working great (IE the extensions are working properly) but when I put it out on a test server, suddenly they are broken. Both servers have the same versions of Python, Dja...

MongoEngine vs MongoKit for Django

Have you used MongoEngine or MongoKit with Django? Which one do you prefer? Background: I'm developing a new site and have experience with normal Django development but for the kind of data I'll be using the MongoDB will be better suited than a SQL database. I'm using Python 2.7 and can compile/install anything on my host so that's no...