Best Python code snippet using avocado_python
urls.py
Source:urls.py
1"""testzzz_21780 URL Configuration2The `urlpatterns` list routes URLs to views. For more information please see:3 https://docs.djangoproject.com/en/2.2/topics/http/urls/4Examples:5Function views6 1. Add an import: from my_app import views7 2. Add a URL to urlpatterns: path('', views.home, name='home')8Class-based views9 1. Add an import: from other_app.views import Home10 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')11Including another URLconf12 1. Import the include() function: from django.urls import include, path13 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))14"""15from django.contrib import admin16from django.urls import path, include17from allauth.account.views import confirm_email18from rest_framework import permissions19from drf_yasg.views import get_schema_view20from drf_yasg import openapi21urlpatterns = [22 path("", include("home.urls")),23 path("accounts/", include("allauth.urls")),24 path("api/v1/", include("home.api.v1.urls")),25 path("admin/", admin.site.urls),26 path("users/", include("users.urls", namespace="users")),27 path("rest-auth/", include("rest_auth.urls")),28 # Override email confirm to use allauth's HTML view instead of rest_auth's API view29 path("rest-auth/registration/account-confirm-email/<str:key>/", confirm_email),30 path("rest-auth/registration/", include("rest_auth.registration.urls")),31]32admin.site.site_header = "testzzz"33admin.site.site_title = "testzzz Admin Portal"34admin.site.index_title = "testzzz Admin"35# swagger36api_info = openapi.Info(37 title="testzzz API",38 default_version="v1",39 description="API documentation for testzzz App",40)41schema_view = get_schema_view(42 api_info,43 public=True,44 permission_classes=(permissions.IsAuthenticated,),45)46urlpatterns += [47 path("api-docs/", schema_view.with_ui("swagger", cache_timeout=0), name="api_docs")...
0002_load_initial_data.py
Source:0002_load_initial_data.py
1from django.db import migrations2def create_customtext(apps, schema_editor):3 CustomText = apps.get_model("home", "CustomText")4 customtext_title = "testzzz"5 CustomText.objects.create(title=customtext_title)6def create_homepage(apps, schema_editor):7 HomePage = apps.get_model("home", "HomePage")8 homepage_body = """9 <h1 class="display-4 text-center">testzzz</h1>10 <p class="lead">11 This is the sample application created and deployed from the Crowdbotics app.12 You can view list of packages selected for this application below.13 </p>"""14 HomePage.objects.create(body=homepage_body)15def create_site(apps, schema_editor):16 Site = apps.get_model("sites", "Site")17 custom_domain = "testzzz-21780.botics.co"18 site_params = {19 "name": "testzzz",20 }21 if custom_domain:22 site_params["domain"] = custom_domain23 Site.objects.update_or_create(defaults=site_params, id=1)24class Migration(migrations.Migration):25 dependencies = [26 ("home", "0001_initial"),27 ("sites", "0002_alter_domain_unique"),28 ]29 operations = [30 migrations.RunPython(create_customtext),31 migrations.RunPython(create_homepage),32 migrations.RunPython(create_site),...
study01.py
Source:study01.py
1print("testzzz")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!