Best Python code snippet using Kiwi_python
__init__.py
Source:__init__.py
...11# Create admin12admin = Admin(13 app," ÛÙÙÛ Ø¨Ûد ",index_view=MyAdminIndexView(),base_template='admin.html',template_mode='bootstrap3',14)15admin.add_view(UserAdmin(User, db.session,name='کاربراÙ',menu_icon_type='fa', menu_icon_value='fa fa-user'))16admin.add_view(RoleAdmin(Role, db.session,name='ÙÙØ´',menu_icon_type='fa', menu_icon_value='fa fa-user'))17admin.add_view(CategoryAdmin(Category, db.session,name='دست٠بÙدÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))18admin.add_view(ProductAdmin(Product, db.session,name='Ù
ØصÙÙات',menu_icon_type='fa', menu_icon_value='fa fa-user'))19admin.add_view(ItemAdmin(Item, db.session,name='Ø¢ÛتÙ
ÙØ§Û Ù
ØصÙÙات',menu_icon_type='fa', menu_icon_value='fa fa-user'))20admin.add_view(AuctionAdmin(Auction, db.session,name='ØØ±Ø§Ø¬Û Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))21admin.add_view(BidAdmin(Bid, db.session,name='بÛدÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))22admin.add_view(PlanAdmin(Plan, db.session,name='Ù¾ÙÙ ÙØ§Û Ù¾ÛØ´ Ùرض',menu_icon_type='fa', menu_icon_value='fa fa-user'))23admin.add_view(AuctionPlanAdmin(AuctionPlan, db.session,name='Ù¾ÙÙ ØراجÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))24admin.add_view(AvatarAdmin(Avatar, db.session,name='Ø¢ÙاتارÙا',menu_icon_type='fa', menu_icon_value='fa fa-user'))25admin.add_view(CoinAdmin(Coin, db.session,name='بست٠ÙØ§Û Ø³Ú©Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))26admin.add_view(GemAdmin(Gem, db.session,name='بست٠ÙØ§Û Ø§ÙÙ
اس',menu_icon_type='fa', menu_icon_value='fa fa-user'))27admin.add_view(ChestAdmin(Chest, db.session,name='Ù¾Ú©Ûج ÙØ§Û Ù¾ÛØ´ÙÙادÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))28admin.add_view(LevelAdmin(Level, db.session,name='Ù
راØÙ',menu_icon_type='fa', menu_icon_value='fa fa-user'))29admin.add_view(AdvertisementAdmin(Advertisement, db.session,name='تبÙÛغات',menu_icon_type='fa', menu_icon_value='fa fa-user'))30admin.add_view(CharityAdmin(Charity, db.session,name='Ø®ÛرÛÙ Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))31admin.add_view(ShipmentMethodAdmin(ShipmentMethod, db.session,name='رÙØ´ ارسا٠پÛØ´ Ùرض',menu_icon_type='fa', menu_icon_value='fa fa-user'))32admin.add_view(ShipmentAdmin(Shipment, db.session,name='گزارش ارسا٠Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))33admin.add_view(ItemShipmentAdmin(ItemShipment, db.session,name='رÙØ´ ارسا٠Ù
ØصÙÙات',menu_icon_type='fa', menu_icon_value='fa fa-user'))34admin.add_view(GarantyAdmin(Garanty, db.session,name='گاراÙØªÛ Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))35admin.add_view(ItemGarantyAdmin(ItemGaranty, db.session,name='گاراÙØªÛ Ù
ØصÙÙات',menu_icon_type='fa', menu_icon_value='fa fa-user'))36admin.add_view(InsuranceAdmin(Insurance, db.session,name='بÛÙ
Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))37admin.add_view(CouponAdmin(Coupon, db.session,name='Ú©Ùپ٠تخÙÛÙ ÙØ§Û Ø³Ø§Ûت',menu_icon_type='fa', menu_icon_value='fa fa-user'))38admin.add_view(ManufactureAdmin(Manufacture, db.session,name='کارخاÙÙ Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))39admin.add_view(StateAdmin(State, db.session,name='استا٠Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))40admin.add_view(UserAuctionParticipationAdmin(UserAuctionParticipation, db.session,name='گزارش شرکت Ú©ÙÙدگا٠ØراجÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))41admin.add_view(UserPlanAdmin(UserPlan, db.session,name='گزارش Ù¾ÙÙ ØØ±Ø§Ø¬Û Ú©Ø§Ø±Ø¨Ø±',menu_icon_type='fa', menu_icon_value='fa fa-user'))42admin.add_view(UserPlanPaymentAdmin(UserPlanPayment, db.session,name='گزارش خرÛد Ù¾Ù٠با درگا٠پرداخت',menu_icon_type='fa', menu_icon_value='fa fa-user'))43admin.add_view(UserPlanCoinPaymentAdmin(UserPlanCoinPayment, db.session,name='گزارش خرÛد Ù¾Ù٠با سکÙ',menu_icon_type='fa', menu_icon_value='fa fa-user'))44admin.add_view(UserPlanGemPaymentAdmin(UserPlanGemPayment, db.session,name='گزارش خرÛد Ù¾Ù٠با اÙÙ
اس',menu_icon_type='fa', menu_icon_value='fa fa-user'))45admin.add_view(UserAvatarAdmin(UserAvatar, db.session,name='گزارش خرÛد اÙتار با اÙÙ
اس',menu_icon_type='fa', menu_icon_value='fa fa-user'))46admin.add_view(UserCoinAdmin(UserCoin, db.session,name='گزارش سک٠ÙØ§Û Ø®Ø±ÛØ¯Ø§Ø±Û Ø´Ø¯Ù Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))47admin.add_view(UserGemAdmin(UserGem, db.session,name='گزارش اÙÙ
اس ÙØ§Û Ø®Ø±ÛØ¯Ø§Ø±Û Ø´Ø¯Ù Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))48admin.add_view(UserChestAdmin(UserChest, db.session,name='گزارش Ù¾Ú©Ûج ÙØ§Û Ù¾ÛØ´ÙÙØ§Ø¯Û Ø®Ø±ÛØ¯Ø§Ø±Û Ø´Ø¯Ù Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))49admin.add_view(PaymentAdmin(Payment, db.session,name='گزارش پرداخت ÙØ§Û Ø¯Ø±Ú¯Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))50admin.add_view(GemPaymentAdmin(GemPayment, db.session,name='گزارش پرداخت اÙÙ
اس',menu_icon_type='fa', menu_icon_value='fa fa-user'))51admin.add_view(CoinPaymentAdmin(CoinPayment, db.session,name='گزارش پرداخت ÙØ§Û Ø³Ú©Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))52admin.add_view(OrderAdmin(Order, db.session,name='گزارش سÙارشات',menu_icon_type='fa', menu_icon_value='fa fa-user'))53admin.add_view(UserCouponAdmin(UserCoupon, db.session,name='گزارش Ú©ÙÙ¾Ù ÙØ§Û ØªØ®ÙÛ٠کاربراÙ',menu_icon_type='fa', menu_icon_value='fa fa-user'))54admin.add_view(PaymentMessageAdmin(PaymentMessage, db.session,name='Ù¾ÛاÙ
Ù¾Ø±Ø¯Ø§Ø®ØªÛ ÙØ§Û Ø³Ø§Ûت',menu_icon_type='fa', menu_icon_value='fa fa-user'))55admin.add_view(UserActivityAdmin(UserActivity, db.session,name='گزارش ÙعاÙÛت ÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))56admin.add_view(AddressAdmin(Address, db.session,name='گزارش آدرس ÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))57# admin.add_view(SettingAdmin(Setting, db.session,name='تÙظÛÙ
ات',menu_icon_type='fa', menu_icon_value='fa fa-user'))58admin.add_view(NotificationAdmin(Notification, db.session,name='ÙاتÛÙÛÚ©ÛØ´Ù Ùا',menu_icon_type='fa', menu_icon_value='fa fa-user'))59admin.add_view(SiteNotificationAdmin(SiteNotification, db.session,name='گزارش ÙاتÛÙÛÚ©ÛØ´Ù ÙØ§Û Ø³Ø§Ûت',menu_icon_type='fa', menu_icon_value='fa fa-user'))60admin.add_view(UserNotificationAdmin(UserNotification, db.session,name='گزارش ÙاتÛÙÛÚ©ÛØ´Ù ÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù',menu_icon_type='fa', menu_icon_value='fa fa-user'))61admin.add_view(AuctionNotificationAdmin(AuctionNotification, db.session,name='اÛجاد ÙاتÛÙÛÚ©ÛØ´Ù ØراجÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))62admin.add_view(UserMessageAdmin(UserMessage, db.session,name='Ù¾ÛاÙ
ÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ø³Ø§Ûت',menu_icon_type='fa', menu_icon_value='fa fa-user'))63admin.add_view(GuestMessageAdmin(GuestMessage, db.session,name='Ù¾ÛاÙ
ÙØ§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ù
ÙÙ
اÙ',menu_icon_type='fa', menu_icon_value='fa fa-user'))64admin.add_view(SMSAdmin(UserSMS, db.session,name='گزارش Ù¾ÛاÙ
Ú© ÙØ§Û Ø§Ø±Ø³Ø§ÙÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))65# admin.add_view(UserAuctionNotificationAdmin(UserAuctionNotification, db.session,name='ÙاتÛÙÛÚ©Ûش٠کاربرا٠ØراجÛ',menu_icon_type='fa', menu_icon_value='fa fa-user'))...
urls.py
Source:urls.py
...4"""5import management_layer.api.views as views6import aiohttp_cors7def add_routes(app, with_ui=False):8 app.router.add_view(r"/usersiteroles/{user_id}/{site_id}/{role_id}", views.UsersiterolesUserIdSiteIdRoleId)9 app.router.add_view(r"/usersiteroles", views.Usersiteroles)10 app.router.add_view(r"/usersitedata/{user_id}/{site_id}", views.UsersitedataUserIdSiteId)11 app.router.add_view(r"/usersitedata", views.Usersitedata)12 app.router.add_view(r"/users/{user_id}", views.UsersUserId)13 app.router.add_view(r"/users", views.Users)14 app.router.add_view(r"/userdomainroles/{user_id}/{domain_id}/{role_id}", views.UserdomainrolesUserIdDomainIdRoleId)15 app.router.add_view(r"/userdomainroles", views.Userdomainroles)16 app.router.add_view(r"/sites/{site_id}", views.SitesSiteId)17 app.router.add_view(r"/sites", views.Sites)18 app.router.add_view(r"/siteroles/{site_id}/{role_id}", views.SiterolesSiteIdRoleId)19 app.router.add_view(r"/siteroles", views.Siteroles)20 app.router.add_view(r"/sitedataschemas/{site_id}", views.SitedataschemasSiteId)21 app.router.add_view(r"/sitedataschemas", views.Sitedataschemas)22 app.router.add_view(r"/roles/{role_id}", views.RolesRoleId)23 app.router.add_view(r"/roles", views.Roles)24 app.router.add_view(r"/roleresourcepermissions/{role_id}/{resource_id}/{permission_id}", views.RoleresourcepermissionsRoleIdResourceIdPermissionId)25 app.router.add_view(r"/roleresourcepermissions", views.Roleresourcepermissions)26 app.router.add_view(r"/resources/{resource_id}", views.ResourcesResourceId)27 app.router.add_view(r"/resources", views.Resources)28 app.router.add_view(r"/request_user_deletion", views.RequestUserDeletion)29 app.router.add_view(r"/refresh/sites", views.RefreshSites)30 app.router.add_view(r"/refresh/roles", views.RefreshRoles)31 app.router.add_view(r"/refresh/resources", views.RefreshResources)32 app.router.add_view(r"/refresh/permissions", views.RefreshPermissions)33 app.router.add_view(r"/refresh/keys", views.RefreshKeys)34 app.router.add_view(r"/refresh/domains", views.RefreshDomains)35 app.router.add_view(r"/refresh/credentials", views.RefreshCredentials)36 app.router.add_view(r"/refresh/clients", views.RefreshClients)37 app.router.add_view(r"/refresh/all", views.RefreshAll)38 app.router.add_view(r"/permissions/{permission_id}", views.PermissionsPermissionId)39 app.router.add_view(r"/permissions", views.Permissions)40 app.router.add_view(r"/organisations/{organisation_id}", views.OrganisationsOrganisationId)41 app.router.add_view(r"/organisations", views.Organisations)42 app.router.add_view(r"/ops/usersitedata", views.OpsUsersitedata)43 app.router.add_view(r"/ops/users_with_roles_for_site/{site_id}", views.OpsUsersWithRolesForSiteSiteId)44 app.router.add_view(r"/ops/users_with_roles_for_domain/{domain_id}", views.OpsUsersWithRolesForDomainDomainId)45 app.router.add_view(r"/ops/user_site_role_labels_aggregated/{user_id}/{site_id}", views.OpsUserSiteRoleLabelsAggregatedUserIdSiteId)46 app.router.add_view(r"/ops/user_site_permissions/{user_id}/{site_id}", views.OpsUserSitePermissionsUserIdSiteId)47 app.router.add_view(r"/ops/user_management_portal_permissions/{user_id}", views.OpsUserManagementPortalPermissionsUserId)48 app.router.add_view(r"/ops/user_has_permissions/{user_id}", views.OpsUserHasPermissionsUserId)49 app.router.add_view(r"/ops/user_domain_permissions/{user_id}/{domain_id}", views.OpsUserDomainPermissionsUserIdDomainId)50 app.router.add_view(r"/ops/site_role_labels_aggregated/{site_id}", views.OpsSiteRoleLabelsAggregatedSiteId)51 app.router.add_view(r"/ops/site_and_domain_roles/{site_id}", views.OpsSiteAndDomainRolesSiteId)52 app.router.add_view(r"/ops/get_sites_under_domain/{domain_id}", views.OpsGetSitesUnderDomainDomainId)53 app.router.add_view(r"/ops/get_site_from_client_token_id/{client_token_id}", views.OpsGetSiteFromClientTokenIdClientTokenId)54 app.router.add_view(r"/ops/domain_roles/{domain_id}", views.OpsDomainRolesDomainId)55 app.router.add_view(r"/ops/confirm_user_data_deletion/{user_id}", views.OpsConfirmUserDataDeletionUserId)56 app.router.add_view(r"/ops/all_user_roles/{user_id}", views.OpsAllUserRolesUserId)57 app.router.add_view(r"/invitationsiteroles/{invitation_id}/{site_id}/{role_id}", views.InvitationsiterolesInvitationIdSiteIdRoleId)58 app.router.add_view(r"/invitationsiteroles", views.Invitationsiteroles)59 app.router.add_view(r"/invitations/{invitation_id}/send", views.InvitationsInvitationIdSend)60 app.router.add_view(r"/invitations/{invitation_id}", views.InvitationsInvitationId)61 app.router.add_view(r"/invitations/purge/expired", views.InvitationsPurgeExpired)62 app.router.add_view(r"/invitations", views.Invitations)63 app.router.add_view(r"/invitationredirecturls/{invitationredirecturl_id}", views.InvitationredirecturlsInvitationredirecturlId)64 app.router.add_view(r"/invitationredirecturls", views.Invitationredirecturls)65 app.router.add_view(r"/invitationdomainroles/{invitation_id}/{domain_id}/{role_id}", views.InvitationdomainrolesInvitationIdDomainIdRoleId)66 app.router.add_view(r"/invitationdomainroles", views.Invitationdomainroles)67 app.router.add_view(r"/healthcheck", views.Healthcheck)68 app.router.add_view(r"/events", views.Events)69 app.router.add_view(r"/domains/{domain_id}", views.DomainsDomainId)70 app.router.add_view(r"/domains", views.Domains)71 app.router.add_view(r"/domainroles/{domain_id}/{role_id}", views.DomainrolesDomainIdRoleId)72 app.router.add_view(r"/domainroles", views.Domainroles)73 app.router.add_view(r"/deletionmethods/{deletionmethod_id}", views.DeletionmethodsDeletionmethodId)74 app.router.add_view(r"/deletionmethods", views.Deletionmethods)75 app.router.add_view(r"/deletedusersites/{user_id}/{site_id}", views.DeletedusersitesUserIdSiteId)76 app.router.add_view(r"/deletedusersites", views.Deletedusersites)77 app.router.add_view(r"/deletedusers/{user_id}", views.DeletedusersUserId)78 app.router.add_view(r"/deletedusers", views.Deletedusers)79 app.router.add_view(r"/credentials/{credentials_id}", views.CredentialsCredentialsId)80 app.router.add_view(r"/credentials", views.Credentials)81 app.router.add_view(r"/countries/{country_code}", views.CountriesCountryCode)82 app.router.add_view(r"/countries", views.Countries)83 app.router.add_view(r"/clients/{client_id}", views.ClientsClientId)84 app.router.add_view(r"/clients", views.Clients)85 app.router.add_view(r"/adminnotes/{admin_note_id}", views.AdminnotesAdminNoteId)86 app.router.add_view(r"/adminnotes", views.Adminnotes)87 if with_ui:88 app.router.add_view(r"/the_specification", views.__SWAGGER_SPEC__)89 app.router.add_static(r"/ui", path="ui")90 # Configure default CORS settings.91 cors = aiohttp_cors.setup(app, defaults={92 "*": aiohttp_cors.ResourceOptions(93 allow_credentials=True,94 expose_headers="*",95 allow_headers="*",96 )97 })98 # Configure CORS on all routes.99 for route in app.router.routes():...
admin.py
Source:admin.py
...5#from flask import Blueprint, render_template, abort6#from jinja2 import TemplateNotFound7from flask_admin.contrib.sqla import ModelView8from application.models import Auth, Classe, Educ, Experiencia, Cert, Horario, Prestador, Subclasse, Sugestao, Suporte, User9admin.add_view(ModelView(Auth, db.session))10admin.add_view(ModelView(Classe, db.session))11admin.add_view(ModelView(Educ, db.session))12admin.add_view(ModelView(Experiencia, db.session))13admin.add_view(ModelView(Cert, db.session))14admin.add_view(ModelView(Horario, db.session))15admin.add_view(ModelView(Prestador, db.session))16admin.add_view(ModelView(Subclasse, db.session))17admin.add_view(ModelView(Sugestao, db.session))18admin.add_view(ModelView(Suporte, db.session))19admin.add_view(ModelView(User, db.session))20#@admin.route('/', defaults={'page': 'index'})21#@admin.route('/<page>')22#def show(page):...
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!!