Add docstrings in views.py
This commit is contained in:
parent
b070f35d5e
commit
e79980554a
@ -25,6 +25,7 @@ REQUIRED_FIELDS = ['name', 'description', 'version', 'bot_version']
|
||||
|
||||
|
||||
class SignUpView(BSModalCreateView):
|
||||
"""Modal signup view"""
|
||||
form_class = CustomUserCreationForm
|
||||
template_name = 'store/signup_modal.html'
|
||||
success_message = 'Success: Sign up succeeded. You can now Log in.'
|
||||
@ -32,6 +33,7 @@ class SignUpView(BSModalCreateView):
|
||||
|
||||
|
||||
class CustomLoginView(BSModalLoginView):
|
||||
"""Modal login view"""
|
||||
authentication_form = CustomAuthenticationForm
|
||||
template_name = 'store/login_modal.html'
|
||||
success_message = 'Success: You were successfully logged in.'
|
||||
@ -39,6 +41,7 @@ class CustomLoginView(BSModalLoginView):
|
||||
|
||||
|
||||
class ModuleListView(ListView):
|
||||
"""Lists all available modules"""
|
||||
model = Module
|
||||
paginate_by = 100
|
||||
|
||||
@ -49,6 +52,7 @@ class ModuleListView(ListView):
|
||||
|
||||
|
||||
class ModuleDetailView(View):
|
||||
"""Shows details about module"""
|
||||
def get(self, request, pk, req_ver="latest"):
|
||||
module = get_object_or_404(Module, id=pk)
|
||||
versions = Version.objects.filter(module=module)
|
||||
@ -70,6 +74,7 @@ class ModuleDetailView(View):
|
||||
|
||||
|
||||
class UploadView(LoginRequiredMixin, FormView):
|
||||
"""Module upload views : read and save sent module archive with dropzone.js"""
|
||||
form_class = FileFieldForm
|
||||
template_name = 'store/upload.html'
|
||||
|
||||
@ -135,7 +140,7 @@ class UploadView(LoginRequiredMixin, FormView):
|
||||
file=file, readme=readme, toml=toml_file)
|
||||
module.save()
|
||||
version.save()
|
||||
toml_file.close()
|
||||
toml_file.close() # Colsing toml file
|
||||
for dependency in module_info['dependencies']:
|
||||
if not Dependency.objects.filter(version=version, dep_module=dependency,
|
||||
dep_version=module_info['dependencies'][dependency]).exists():
|
||||
|
Loading…
Reference in New Issue
Block a user