Passed
Push — master ( bfcb4c...700bc6 )
by Piotr
01:05
created

PasswordResetEmail.get_context_data()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
1
from django.contrib.auth.tokens import default_token_generator
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
introduced by
Unable to import 'django.contrib.auth.tokens'
Loading history...
2
3
from templated_mail.mail import BaseEmailMessage
0 ignored issues
show
introduced by
Unable to import 'templated_mail.mail'
Loading history...
4
5
from djoser import utils
6
from djoser.conf import settings
7
8
9
class ActivationEmail(BaseEmailMessage):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
10
    template_name = 'email/activation.html'
11
12
    def get_context_data(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
13
        context = super(ActivationEmail, self).get_context_data()
14
15
        user = context.get('user')
16
        context['uid'] = utils.encode_uid(user.pk)
17
        context['token'] = default_token_generator.make_token(user)
18
        context['url'] = settings.ACTIVATION_URL.format(**context)
19
        return context
20
21
22
class ConfirmationEmail(BaseEmailMessage):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
23
    template_name = 'email/confirmation.html'
24
25
26
class PasswordResetEmail(BaseEmailMessage):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
27
    template_name = 'email/password_reset.html'
28
29
    def get_context_data(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
30
        context = super(PasswordResetEmail, self).get_context_data()
31
32
        user = context.get('user')
33
        context['uid'] = utils.encode_uid(user.pk)
34
        context['token'] = default_token_generator.make_token(user)
35
        context['url'] = settings.ACTIVATION_URL.format(**context)
36
        return context
37