1. 程式人生 > >django-學習-驗證碼

django-學習-驗證碼

寫一個前後端分離的小專案,一邊看django,一邊看vue. 在寫使用者登入註冊的時候,需要驗證碼,這時候用到了django-simple-captcha 下面是這個其中的一個模型類:

>>> 

class CaptchaStore(django.db.models.base.Model)
 |  CaptchaStore(*args, **kwargs)
 |
 |  CaptchaStore(id, challenge, response, hashkey, expiration)
 |
 |  Method resolution order:
 |      CaptchaStore
 |      django.db.models.base.Model
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __str__(self)
 |      Return str(self).
 |
 |  challenge = <django.db.models.query_utils.DeferredAttribute object>
 |  expiration = <django.db.models.query_utils.DeferredAttribute object>
 |  get_next_by_expiration = _method(self, *, field=<django.db.models.fields.DateTimeField: expiration>, is_next=True, **kwargs)
 |
 |  get_previous_by_expiration = _method(self, *, field=<django.db.models.fields.DateTimeField: expiration>, is_next=False, **kwargs)
 |
 |  hashkey = <django.db.models.query_utils.DeferredAttribute object>
 |  id = <django.db.models.query_utils.DeferredAttribute object>
 |  response = <django.db.models.query_utils.DeferredAttribute object>
 |  save(self, *args, **kwargs)
 |      Save the current instance. Override this in a subclass if you want to
 |      control the saving process.
 |
 |      The 'force_insert' and 'force_update' parameters can be used to insist
 |      that the "save" must be an SQL insert or update (or equivalent for
 |      non-SQL backends), respectively. Normally, they should not be set.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  create_pool(count=1000) from django.db.models.base.ModelBase
 |	
 |  generate_key(generator=None) from django.db.models.base.ModelBase
 |
 |  pick() from django.db.models.base.ModelBase
 | 
 |  remove_expired() from django.db.models.base.ModelBase
    呼叫它可以一次刪除過期的資料庫中的行