This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from io import StringIO | |
| from django.core.management import call_command | |
| from django.test import TestCase | |
| class MyCommandTest(TestCase): | |
| def test_my_command(self): | |
| out = StringIO() # <-- Use StringIO to capture the output of the command from stdout | |
| args = [] # <-- Any command line arguments go here | |
| kwargs = {'stdout': out} # <-- Any named command line options (e.g. --my-option) go here | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias foo="echo 'I pity the foo'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% load static %} | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <h1>Testing Vue...</h1> | |
| <div id="app"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| module.exports = { | |
| publicPath: '/static/src/vue/dist/', // Should be STATIC_URL + path/to/build | |
| outputDir: path.resolve(__dirname, '../static/src/vue/dist/'), // Output to a directory in STATICFILES_DIRS | |
| filenameHashing: false, // Django will hash file names, not webpack | |
| runtimeCompiler: true, // See: https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only | |
| devServer: { | |
| writeToDisk: true, // Write files to disk in dev mode, so Django can serve the assets | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Static files (CSS, JavaScript, Images) | |
| # https://docs.djangoproject.com/en/3.0/howto/static-files/ | |
| STATIC_URL = '/static/' | |
| STATIC_ROOT = 'var/static_root/' | |
| STATICFILES_DIRS = ['static'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| from django.urls import path | |
| from myapp import views as myapp_views | |
| urlpatterns = [ | |
| path('admin/', admin.site.urls), | |
| path('vue-test', myapp_views.vue_test), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.shortcuts import render | |
| def vue_test(request): | |
| return render(request, 'myapp/vue-test.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head></head> | |
| <body> | |
| <h1>Testing Vue...</h1> | |
| <div id="app"></div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue' | |
| import App from './App.vue' | |
| Vue.config.productionTip = false | |
| new Vue({ | |
| render: h => h(App), | |
| }).$mount('#app') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def analyze_audit_history(self): | |
| """ Parse audit history response and separate out deletes vs modifications/creations """ | |
| last_modified_by_type, modified_ids, deleted_ids = {}, set(), set() | |
| last_modified_by_type['glbatch'] = arrow.now() # Always consider glbatches modified | |
| for audit_trail in self._get_audit_trail(): | |
| for event in audit_trail.response.data.find_all('audithistory'): | |
| object_type = event.objecttype.get_text() | |
| # Consolidate journal and glbatch to be the same, since they hit the same endpoint |