Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
GSoC Update: [Check Constraints] New features and using it with Newforms.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Thejaswi Puthraya  
View profile  
 More options Jul 25 2007, 10:06 pm
From: Thejaswi Puthraya <thejaswi.puthr...@gmail.com>
Date: Thu, 26 Jul 2007 02:06:49 -0000
Local: Wed, Jul 25 2007 10:06 pm
Subject: GSoC Update: [Check Constraints] New features and using it with Newforms.
Hello Django Developers,
This week I worked on getting the 'like' and 'between' check
conditions into the project and also writing a lot of doctests.

So here is how to use 'like' and 'between' check constraints....

class Manufacturer(models.Model):
        mfg_name        =       models.CharField(maxlength=50)
        car_sale_start  =       models.DateField()
        car_sale_end    =       models.DateField()
        quantity_sold   =       models.IntegerField()
        car_price       =       models.IntegerField()

        class Meta:
                constraints = (
                                ("check_name",Check(mfg_name__like =
'Merc*')),

("check_date",Check(car_sale_start__between =
[date(2007,1,1),date(2008,1,1)])),

("check_end_date",Check(car_sale_end__gte = 'car_sale_start')),

("check_quantity",Check(quantity_sold__gte = 0)),

("check_price",Check(car_price__between = [1000,10000])),
                              )

In the 'like' check data '*' matches 0 or more characters whereas '+'
matches a single character. (might go for a change, replacing '+' for
a '.')

'between' expects a two-element list which give the bounds for the
field.
The output SQL is:

CREATE TABLE "appname_manufacturer" (
    "id" serial NOT NULL PRIMARY KEY,
    "mfg_name" varchar(50) NOT NULL,
    "car_sale_start" date NOT NULL,
    "car_sale_end" date NOT NULL,
    "quantity_sold" integer NOT NULL,
    "car_price" integer NOT NULL,
    CONSTRAINT "check_name" CHECK ("mfg_name" like 'Merc%%'),
    CONSTRAINT "check_date" CHECK ("car_sale_start" between date
'2007-01-01' AND date '2008-01-01'),
    CONSTRAINT "check_end_date" CHECK ("car_sale_end" >=
car_sale_start),
    CONSTRAINT "check_quantity" CHECK ("quantity_sold" >= 0),
    CONSTRAINT "check_price" CHECK ("car_price" between 1000 AND
10000)
)
;

Here is a way of using Newforms and Django Check Constraints
http://thejuhyd.blogspot.com/2007/07/django-newforms-and-django-check...

This week I will work on adding support for the datetime field and
decide on whether to support the upper and lower functions.

Cheers
Thejaswi Puthraya


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Gonsalves  
View profile  
 More options Jul 25 2007, 10:56 pm
From: Kenneth Gonsalves <law...@thenilgiris.com>
Date: Thu, 26 Jul 2007 08:26:51 +0530
Local: Wed, Jul 25 2007 10:56 pm
Subject: Re: GSoC Update: [Check Constraints] New features and using it with Newforms.

On 26-Jul-07, at 7:36 AM, Thejaswi Puthraya wrote:

> This week I worked on getting the 'like' and 'between' check
> conditions into the project and also writing a lot of doctests.

could you post this to the users list also - you may get a lot of  
feedback from the user's point of view

--

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Kaplan-Moss  
View profile  
 More options Jul 26 2007, 12:12 pm
From: "Jacob Kaplan-Moss" <jacob.kaplanm...@gmail.com>
Date: Thu, 26 Jul 2007 09:12:38 -0700
Local: Thurs, Jul 26 2007 12:12 pm
Subject: Re: GSoC Update: [Check Constraints] New features and using it with Newforms.
On 7/25/07, Kenneth Gonsalves <law...@thenilgiris.com> wrote:

> On 26-Jul-07, at 7:36 AM, Thejaswi Puthraya wrote:
> > This week I worked on getting the 'like' and 'between' check
> > conditions into the project and also writing a lot of doctests.

> could you post this to the users list also - you may get a lot of
> feedback from the user's point of view

Actually, I've deliberately asked the SoC students to post updates
here instead of django-users. I know all the core devs read both
groups, but we skim -users most more lightly than -dev, and these
updates need to be seen by developers. I'd rather not mix up the
distinction between -users and -dev.

Jacob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Tobin  
View profile  
 More options Jul 26 2007, 12:49 pm
From: "Tom Tobin" <korp...@korpios.com>
Date: Thu, 26 Jul 2007 11:49:07 -0500
Local: Thurs, Jul 26 2007 12:49 pm
Subject: Re: GSoC Update: [Check Constraints] New features and using it with Newforms.
On 7/26/07, Jacob Kaplan-Moss <jacob.kaplanm...@gmail.com> wrote:

> On 7/25/07, Kenneth Gonsalves <law...@thenilgiris.com> wrote:
> > On 26-Jul-07, at 7:36 AM, Thejaswi Puthraya wrote:
> > > This week I worked on getting the 'like' and 'between' check
> > > conditions into the project and also writing a lot of doctests.

> > could you post this to the users list also - you may get a lot of
> > feedback from the user's point of view

> Actually, I've deliberately asked the SoC students to post updates
> here instead of django-users. I know all the core devs read both
> groups, but we skim -users most more lightly than -dev, and these
> updates need to be seen by developers. I'd rather not mix up the
> distinction between -users and -dev.

... and some of us bastards don't read -users at all.  ^_^

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Gonsalves  
View profile  
 More options Jul 26 2007, 9:18 pm
From: Kenneth Gonsalves <law...@thenilgiris.com>
Date: Fri, 27 Jul 2007 06:48:56 +0530
Local: Thurs, Jul 26 2007 9:18 pm
Subject: Re: GSoC Update: [Check Constraints] New features and using it with Newforms.

On 26-Jul-07, at 9:42 PM, Jacob Kaplan-Moss wrote:

>> could you post this to the users list also - you may get a lot of
>> feedback from the user's point of view

> Actually, I've deliberately asked the SoC students to post updates
> here instead of django-users. I know all the core devs read both
> groups, but we skim -users most more lightly than -dev, and these
> updates need to be seen by developers. I'd rather not mix up the
> distinction between -users and -dev.

i agree - these should be in -dev, I just felt that this particular  
post would excite/interest users so asked if he could post it in -
users also.

--

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »