Skip to content

Commit 2eeb07a

Browse files
committed
Fix docstrings
1 parent da7f46b commit 2eeb07a

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

mailauth/contrib/user/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class EmailUserManager(BaseUserManager):
88
use_in_migrations = True
99

1010
def _create_user(self, email, **extra_fields):
11-
"""
12-
Create and save a user with the given username, email, and password.
13-
"""
11+
"""Create and save a user with the given email."""
1412
email = self.normalize_email(email)
1513
user = self.model(email=email, **extra_fields)
1614
user.save(using=self._db)

mailauth/forms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def get_login_url(self, request, token, next=None):
2323
2424
Returns:
2525
str: User login URL including the access token.
26+
2627
"""
2728
protocol = 'https' if request.is_secure() else 'http'
2829
current_site = get_current_site(request)
@@ -74,7 +75,9 @@ def get_context(self, request, user):
7475

7576
def save(self):
7677
"""
77-
Method will be called from the view, if the form is valid.
78+
Send login URL to users.
79+
80+
Called from the login view, if the form is valid.
7881
7982
This method must be implemented by subclasses. This method
8083
should trigger the login url to be sent to the user.
@@ -84,6 +87,7 @@ def save(self):
8487

8588
class EmailLoginForm(BaseLoginForm):
8689
"""Login form that contains only the Users email field."""
90+
8791
subject_template_name = 'registration/login_subject.txt'
8892
email_template_name = 'registration/login_email.txt'
8993
html_email_template_name = 'registration/login_email.html'

mailauth/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717
class LoginView(DjangoLoginView):
1818
"""
19-
Sends a login code to the user.
20-
It doesn't authenticate a user but it is the entry point for the login process (login url).
19+
Send a login code to the user.
20+
21+
It doesn't authenticate a user but it is the entry point for the login process (login URL).
2122
"""
2223

2324
form_class = forms.EmailLoginForm

tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def timestamp(self):
1414

1515
@pytest.fixture()
1616
def user(db):
17-
"""A user instance."""
17+
"""Return a user instance."""
1818
return get_user_model().objects.create_user(
1919
pk=1337,
2020
email='spiderman@avengers.com',
@@ -24,7 +24,7 @@ def user(db):
2424

2525
@pytest.fixture()
2626
def admin_user(db):
27-
"""A user instance."""
27+
"""Return a user instance."""
2828
return get_user_model().objects.create_user(
2929
pk=1337,
3030
email='spiderman@avengers.com',
@@ -35,11 +35,11 @@ def admin_user(db):
3535

3636
@pytest.fixture()
3737
def signature():
38-
"""A signature matching the user fixture."""
38+
"""Return a signature matching the user fixture."""
3939
return 'LZ/173QUS/1Hjptg/fTLJcaon_7zMDyFTIFtlDqbdSt4'
4040

4141

4242
@pytest.fixture()
4343
def signer():
44-
"""A forzen version of the UserSigner."""
44+
"""Return a forzen version of the UserSigner."""
4545
return FrozenUserSigner(sep='/')

tests/testapp/urls.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
"""testapp URL Configuration
2-
3-
The `urlpatterns` list routes URLs to views. For more information please see:
4-
https://docs.djangoproject.com/en/2.2/topics/http/urls/
5-
Examples:
6-
Function views
7-
1. Add an import: from my_app import views
8-
2. Add a URL to urlpatterns: path('', views.home, name='home')
9-
Class-based views
10-
1. Add an import: from other_app.views import Home
11-
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12-
Including another URLconf
13-
1. Import the include() function: from django.urls import include, path
14-
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15-
"""
161
from django.contrib import admin
172
from django.urls import include, path
183

0 commit comments

Comments
 (0)