Re: Is it possible to specifyc validate_min and validate_max on contrib.Admin formset ? (From Django's code, it seems not)

2015-08-17 Thread boitoletre
There is actually a workflow that feels inconsistent if we cannot easily enforce validate_min & _max on the Formset of the contrib.Admin. Example: a) For model A, attach an Inline for model B (B having a ForeingKey to A), with min_num < max_num b) create an instance of A in the Admin interface: y

Re: Architectural suggestions for (Django + API)

2015-08-17 Thread julio . lacerda
Hi James, I'm going to build a separated instance to provide only REST services to be consumed by Project A. It's ok to use the same views to provide a REST interface in API but in this case I need to remove models from project A, right? Thank you very much! Em domingo, 16 de agosto de 2015 2

Re: Architectural suggestions for (Django + API)

2015-08-17 Thread julio . lacerda
Hi Carl, > I don't quite understand why the situation you describe requires > duplicating models files. Is the canonical data storage now in Project B > instead of Project A, and Project A gets the data via Project B's REST > API? In that case, why does Project A need those models anymore?

Re: Why should I care to use YAML with Django?

2015-08-17 Thread Bill Freeman
One interesting feature of YAML is the ability to have custom operators. For example, with YAML used as a fixture, you might have an operator that turns a hex string into a MongoDB ObjectId on read, or a date string into a datetime object, meaning that you don't have to post process the data read.

the right way to generate my model/db_table

2015-08-17 Thread Naftali Michalowsky
Hello, I went through the tutorial with in mind to go through it again using it to set up my small app. I am making a simple app where users can search a large set of strings and get a subset as a result. The only relevant search criteria is the first and last character of the string. So th

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread Michael Herrmann
Hi gst, Instead of class Hotel(Place): ... I ended up with class Hotel(object): place = models.OneToOneField(Place, primary_key=True) I used a OneToOneField instead of ForeignKey because there can only be one hotel in a Place. M On 16 August 2015 at 16:22, gst wrote:

is there anybody who test this django mongodb engine ?

2015-08-17 Thread MahdiX
Hi folks I just start learning and using mongoDB , it's looks like a really nice replacement for mysql. I was searching for 3rd party for using Mongo with django and I ends up with django-mongodb-engine. Has anybody test it? I'm looking for personal experiences -- You received this message beca

Need help in Django Task

2015-08-17 Thread conticki
Task to be done in Django Table structure: - Movies - id - Title - Description - Featured image - Movie length (in minutes) - Movie release date Example: 1 | Jurassic World | A movie about dinosaurs | 90 minutes | June 14 2015 2 | Kick | Salman Khan mo

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread James Schneider
Hi gst, > > Instead of > > class Hotel(Place): > ... > > I ended up with > > class Hotel(object): > place = models.OneToOneField(Place, primary_key=True) > > I used a OneToOneField instead of ForeignKey because there can only be one > hotel in a Place. > > > Just to verify,

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread Michael Herrmann
Yes, of course you're right James, sorry. My classes are actually named differently and I was just trying to get the idea across. M On 17 August 2015 at 22:23, James Schneider wrote: > > > Hi gst, >> >> Instead of >> >> class Hotel(Place): >> ... >> >> I ended up with >> >> class

Re: Django: "Fake" multiple inheritance

2015-08-17 Thread James Schneider
Just making sure. Good luck! -James On Aug 17, 2015 1:25 PM, "Michael Herrmann" wrote: > Yes, of course you're right James, sorry. My classes are actually named > differently and I was just trying to get the idea across. > M > > On 17 August 2015 at 22:23, James Schneider > wrote: > >> >> >> Hi

Django foreign key in SlugRelatedField

2015-08-17 Thread Shekar Tippur
Hello, I am trying to create a form that takes input needed for parent child tables. I am unable to create records via post call. It is a simple parent child relationship. I want to be able to create the parent if it does not exist and create a child right after. I guess I am not able to unders

Query question

2015-08-17 Thread Lee Hinde
Given this model, I want to find all ProductSale objects that have expired and where the Person doesn't have a later (unexpired) purchase of the same product. class ProductSale(models.Model): product = models.ForeignKey(Product) person = models.ForeignKey(Person) ... date_expires = mod

Re: Query question

2015-08-17 Thread Dheerendra Rathor
You should use 'F' expression from django.db.models So your expression would be like: ProductSale.objects.all().filter(date_expires__lg = now()).exclude(date_purchased__gt = F('date_expires')) On Tuesday, 18 August 2015 06:26:56 UTC+5:30, Lee Hinde wrote: > > Given this model, I want to find

Re: Query question

2015-08-17 Thread Dheerendra Rathor
You should use 'F' expression from django.db.models So your expression would be like: ProductSale.objects.all().filter(date_expires__lt = now().date).exclude( date_purchased__gt = F('date_expires')) Which roughly translates to SELECT * FROM productsale WHERE date_expires < CURRENT_DATE AND NOT