Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#235 closed defect (wontfix)

meta.HashField()

Reported by: maurycy Owned by: adrian
Component: Metasystem Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It's very common to save passwords this way:

class Test(meta.Model):
  fields = (
    meta.CharField('username', 'username', maxlength=64),
    meta.CharField('password_md5', 'password MD5 hash', maxlength=32),
  )

As you see, MD5 hash of the password is saved in !meta.CharField field. Aside of limiting to only MD5 hash, programmer has to remember length of the generated hash and during read or write to handle it with her or his own functions on the Python layer, like md5.

My proposal is to create meta.HashField() field, which would preserve programmers time and take care on these common operations, as they could be done on database-side with bult-in functions like MD5() or other. It would also can support param type specifing which hash algorith to use.

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

This is easy enough to handle with a pre-save hook (http://www.djangoproject.com/documentation/model_api/#model-methods).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.