On Fri, Jul 9, 2010 at 4:52 PM, Sells, Fred
<[email protected]> wrote:
> I've got a model as illustrated below.  Is there any way I can define my
> own attributes that are not columns like the "fredsstuff" below?
>
>
> class A(MDSSection):
>    A0100A    = models.CharField(max_length=10, help_text='''Text      :
> Facility National Provider Identifier (NPI)''')
>    A0100B    = models.CharField(max_length=12, help_text='''Text      :
> Facility CMS Certification Number (CCN)''')
>    A0100C    = models.CharField(max_length=15, help_text='''Text      :
> State provider number''')
>    A0200     = models.CharField(max_length= 1, help_text='''Code      :
> Type of provider''')
>    A0310A    = models.CharField(max_length= 2, help_text='''Code      :
> Type of assessment: OBRA''')
> ...
>    class Meta:
>        db_table = 'A'
>        fredsstuff = "xyzzzz"
>
>    def validate(self):
>        errors = self.checkThis(fredsstuff)
>        return errors

Just put fredsstuff at class-level

class A(MDSSection):
     # fields here...

     # class attributes
     foo = 'bar'

     def do_stuff(self):
         return self.foo

You can access with:
 A.foo
or
  obj = A.objects.all()[0]
  obj.foo

~Rolando

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to