LoginSignup
0
0

More than 3 years have passed since last update.

MEMO

Posted at

おMEMO

Model

ModelClassメソッド

共有の処理は、作成したモデル内へメソッド化すると良さそう。

models.py
class ExampleModel(models.Model):
    class Meta(object):
        db_table = 'example'
    count = models.IntegerField(verbose_name='', default=0)
    def post_login(self):
        self.count += 1
        self.save()

View

ログアウト時の処理

モジュール使用。

view.py
from django.contrib.auth import logout

auth_logout(request)

追記中

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0