|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# **Basic Imports**\n", |
| 8 | + "\n", |
| 9 | + "These are the basic code imports we are going to use for this Getting Started Guide. Make sure to put them at the \n", |
| 10 | + "beginning of your Python Script for things to work as expected.\n", |
| 11 | + "\n", |
| 12 | + "- **Uncomment and/or edit lines as needed depending on your development environment**" |
| 13 | + ] |
| 14 | + }, |
| 15 | + { |
| 16 | + "cell_type": "code", |
| 17 | + "execution_count": 2, |
| 18 | + "metadata": { |
| 19 | + "ExecuteTime": { |
| 20 | + "end_time": "2024-01-09T01:37:18.805566Z", |
| 21 | + "start_time": "2024-01-09T01:37:18.766029Z" |
| 22 | + }, |
| 23 | + "tags": [] |
| 24 | + }, |
| 25 | + "outputs": [], |
| 26 | + "source": [ |
| 27 | + "import os\n", |
| 28 | + "from datetime import date, datetime\n", |
| 29 | + "from decimal import Decimal\n", |
| 30 | + "from random import randint, choices, random\n", |
| 31 | + "from zoneinfo import ZoneInfo\n", |
| 32 | + "from pathlib import Path\n", |
| 33 | + "from pprint import pprint\n", |
| 34 | + "\n", |
| 35 | + "\n", |
| 36 | + "import django\n", |
| 37 | + "# for easier visualization it is recommended to use pandas to render data...\n", |
| 38 | + "# if pandas is not installed, you may install it with this command: pip install -U pandas\n", |
| 39 | + "# pandas is not a dependecy of django_ledger...\n", |
| 40 | + "import pandas as pd\n", |
| 41 | + "from django.core.exceptions import ObjectDoesNotExist\n", |
| 42 | + "from django.conf import settings\n", |
| 43 | + "\n", |
| 44 | + "# Set your django settings module if needed...\n", |
| 45 | + "os.environ['DJANGO_SETTINGS_MODULE'] = 'django_ledger_starter.settings'\n", |
| 46 | + "\n", |
| 47 | + "# if using jupyter notebook need to set DJANGO_ALLOW_ASYNC_UNSAFE as \"true\"\n", |
| 48 | + "os.environ['DJANGO_ALLOW_ASYNC_UNSAFE'] = 'true'\n", |
| 49 | + "\n", |
| 50 | + "# change your working directory as needed...\n", |
| 51 | + "# os.chdir('/path/to/working_dir/')\n", |
| 52 | + "\n", |
| 53 | + "django.setup()\n", |
| 54 | + "\n", |
| 55 | + "from django_ledger.models import EntityModel, ChartOfAccountModel, AccountModel\n", |
| 56 | + "from django.contrib.auth import get_user_model\n", |
| 57 | + "from django_ledger.io import roles, DEBIT, CREDIT\n", |
| 58 | + "from django_ledger.io.io_library import IOBluePrint, IOLibrary" |
| 59 | + ] |
| 60 | + } |
| 61 | + ], |
| 62 | + "metadata": { |
| 63 | + "kernelspec": { |
| 64 | + "display_name": "Python 3 (ipykernel)", |
| 65 | + "language": "python", |
| 66 | + "name": "python3" |
| 67 | + }, |
| 68 | + "language_info": { |
| 69 | + "codemirror_mode": { |
| 70 | + "name": "ipython", |
| 71 | + "version": 3 |
| 72 | + }, |
| 73 | + "file_extension": ".py", |
| 74 | + "mimetype": "text/x-python", |
| 75 | + "name": "python", |
| 76 | + "nbconvert_exporter": "python", |
| 77 | + "pygments_lexer": "ipython3", |
| 78 | + "version": "3.11.6" |
| 79 | + } |
| 80 | + }, |
| 81 | + "nbformat": 4, |
| 82 | + "nbformat_minor": 4 |
| 83 | +} |
0 commit comments