Merge pull request #507 from MicroPyramid/new_release

new release
This commit is contained in:
Ashwin Kumar 2023-10-04 11:25:05 +05:30 committed by GitHub
commit 4dc734a3bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
241 changed files with 8298 additions and 10371 deletions

View file

@ -1,5 +1,6 @@
FROM ubuntu:20.04
# invalidate cache
ARG APP_NAME
# test arg

4
Jenkinsfile vendored
View file

@ -6,7 +6,7 @@ pipeline {
APP_NAME = "bottlecrm-api"
DOCKERHUB = credentials("dockerhub")
DOCKER_IMAGE_TAG = "build-${env.BUILD_NUMBER}-${env.GIT_COMMIT[0..7]}"
DOCKER_IMAGE = "ashwin31/bottlecrm-api:${env.DOCKER_IMAGE_TAG}"
DOCKER_IMAGE = "ashwin31/django-crm:${env.DOCKER_IMAGE_TAG}"
DOCKER_CONFIG = "config.json"
}
@ -26,7 +26,7 @@ pipeline {
}
stage('trigger deploy') {
steps {
build job: 'bottlecrm-api-deploy', parameters: [
build job: 'deploy', parameters: [
string(
name: 'ENV_TYPE',
value: "${env.ENV_TYPE}"

View file

@ -154,4 +154,3 @@ For commercial support [Contact us](https://micropyramid.com/contact-us/)
# Trigger deploy

20
Steps Normal file
View file

@ -0,0 +1,20 @@
Google Login
org
1)List
2)Create
3)Update
4)Add User to organisation
5)Remove User from organisation
6)Change user permission
Leads
1)List
2)Create
3)Update
4)LeadDetailView
5)upload
6)Lead comment
7)Lead attachment

File diff suppressed because one or more lines are too long

View file

@ -1,62 +0,0 @@
# Generated by Django 2.1.2 on 2019-01-28 07:07
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("accounts", "0001_initial"),
("common", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name="account",
name="assigned_to",
field=models.ManyToManyField(
related_name="account_assigned_to", to=settings.AUTH_USER_MODEL
),
),
migrations.AddField(
model_name="account",
name="billing_address",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="account_billing_address",
to="common.Address",
),
),
migrations.AddField(
model_name="account",
name="created_by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="account_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="account",
name="shipping_address",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="account_shipping_address",
to="common.Address",
),
),
migrations.AddField(
model_name="account",
name="teams",
field=models.ManyToManyField(to="common.Team"),
),
]

View file

@ -0,0 +1,112 @@
# Generated by Django 4.2.1 on 2023-06-19 13:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('leads', '0001_initial'),
('teams', '0001_initial'),
('accounts', '0001_initial'),
('contacts', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('common', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='tags',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='tags',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='accountemaillog',
name='contact',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contact_email_log', to='contacts.contact'),
),
migrations.AddField(
model_name='accountemaillog',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='accountemaillog',
name='email',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='email_log', to='accounts.accountemail'),
),
migrations.AddField(
model_name='accountemaillog',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='accountemail',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='accountemail',
name='from_account',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sent_email', to='accounts.account'),
),
migrations.AddField(
model_name='accountemail',
name='recipients',
field=models.ManyToManyField(related_name='recieved_email', to='contacts.contact'),
),
migrations.AddField(
model_name='accountemail',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='account',
name='assigned_to',
field=models.ManyToManyField(related_name='account_assigned_users', to='common.profile'),
),
migrations.AddField(
model_name='account',
name='contacts',
field=models.ManyToManyField(related_name='account_contacts', to='contacts.contact'),
),
migrations.AddField(
model_name='account',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='account_created_by', to='common.profile'),
),
migrations.AddField(
model_name='account',
name='lead',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='account_leads', to='leads.lead'),
),
migrations.AddField(
model_name='account',
name='org',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='account_org', to='common.org'),
),
migrations.AddField(
model_name='account',
name='tags',
field=models.ManyToManyField(blank=True, to='accounts.tags'),
),
migrations.AddField(
model_name='account',
name='teams',
field=models.ManyToManyField(related_name='account_teams', to='teams.teams'),
),
migrations.AddField(
model_name='account',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
]

View file

@ -1,34 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-01 13:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0002_auto_20190128_1237"),
]
operations = [
migrations.CreateModel(
name="Tags",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=20)),
("slug", models.CharField(blank=True, max_length=20, unique=True)),
],
),
migrations.AddField(
model_name="account",
name="tags",
field=models.ManyToManyField(blank=True, to="accounts.Tags"),
),
]

View file

@ -1,30 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-04 06:12
from django.db import migrations, models
def generate_status(apps, schema_editor):
Account = apps.get_model("accounts", "Account")
for account in Account.objects.all():
account.status = "open"
account.save()
class Migration(migrations.Migration):
dependencies = [
("accounts", "0003_auto_20190201_1840"),
]
operations = [
migrations.AddField(
model_name="account",
name="status",
field=models.CharField(
choices=[("open", "Open"), ("close", "Close")],
default="open",
max_length=64,
),
),
migrations.RunPython(generate_status, migrations.RunPython.noop),
]

View file

@ -1,52 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-12 08:04
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contacts", "0002_auto_20190212_1334"),
("leads", "0004_auto_20190212_1334"),
("accounts", "0004_account_status"),
]
operations = [
migrations.RemoveField(
model_name="account",
name="assigned_to",
),
migrations.RemoveField(
model_name="account",
name="teams",
),
migrations.AddField(
model_name="account",
name="contacts",
field=models.ManyToManyField(
related_name="account_contacts", to="contacts.Contact"
),
),
migrations.AddField(
model_name="account",
name="leads",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="account_leads",
to="leads.Lead",
),
),
migrations.AlterField(
model_name="account",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="account_created_by",
to=settings.AUTH_USER_MODEL,
),
),
]

View file

@ -1,326 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-12 11:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0005_auto_20190212_1334"),
]
operations = [
migrations.RenameField(
model_name="account",
old_name="leads",
new_name="lead",
),
migrations.RemoveField(
model_name="account",
name="billing_address",
),
migrations.RemoveField(
model_name="account",
name="shipping_address",
),
migrations.AddField(
model_name="account",
name="billing_address_line",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="Address"
),
),
migrations.AddField(
model_name="account",
name="billing_city",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="City"
),
),
migrations.AddField(
model_name="account",
name="billing_country",
field=models.CharField(
blank=True,
choices=[
("GB", "United Kingdom"),
("AF", "Afghanistan"),
("AX", "Aland Islands"),
("AL", "Albania"),
("DZ", "Algeria"),
("AS", "American Samoa"),
("AD", "Andorra"),
("AO", "Angola"),
("AI", "Anguilla"),
("AQ", "Antarctica"),
("AG", "Antigua and Barbuda"),
("AR", "Argentina"),
("AM", "Armenia"),
("AW", "Aruba"),
("AU", "Australia"),
("AT", "Austria"),
("AZ", "Azerbaijan"),
("BS", "Bahamas"),
("BH", "Bahrain"),
("BD", "Bangladesh"),
("BB", "Barbados"),
("BY", "Belarus"),
("BE", "Belgium"),
("BZ", "Belize"),
("BJ", "Benin"),
("BM", "Bermuda"),
("BT", "Bhutan"),
("BO", "Bolivia"),
("BA", "Bosnia and Herzegovina"),
("BW", "Botswana"),
("BV", "Bouvet Island"),
("BR", "Brazil"),
("IO", "British Indian Ocean Territory"),
("BN", "Brunei Darussalam"),
("BG", "Bulgaria"),
("BF", "Burkina Faso"),
("BI", "Burundi"),
("KH", "Cambodia"),
("CM", "Cameroon"),
("CA", "Canada"),
("CV", "Cape Verde"),
("KY", "Cayman Islands"),
("CF", "Central African Republic"),
("TD", "Chad"),
("CL", "Chile"),
("CN", "China"),
("CX", "Christmas Island"),
("CC", "Cocos (Keeling) Islands"),
("CO", "Colombia"),
("KM", "Comoros"),
("CG", "Congo"),
("CD", "Congo, The Democratic Republic of the"),
("CK", "Cook Islands"),
("CR", "Costa Rica"),
("CI", "Cote d'Ivoire"),
("HR", "Croatia"),
("CU", "Cuba"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DK", "Denmark"),
("DJ", "Djibouti"),
("DM", "Dominica"),
("DO", "Dominican Republic"),
("EC", "Ecuador"),
("EG", "Egypt"),
("SV", "El Salvador"),
("GQ", "Equatorial Guinea"),
("ER", "Eritrea"),
("EE", "Estonia"),
("ET", "Ethiopia"),
("FK", "Falkland Islands (Malvinas)"),
("FO", "Faroe Islands"),
("FJ", "Fiji"),
("FI", "Finland"),
("FR", "France"),
("GF", "French Guiana"),
("PF", "French Polynesia"),
("TF", "French Southern Territories"),
("GA", "Gabon"),
("GM", "Gambia"),
("GE", "Georgia"),
("DE", "Germany"),
("GH", "Ghana"),
("GI", "Gibraltar"),
("GR", "Greece"),
("GL", "Greenland"),
("GD", "Grenada"),
("GP", "Guadeloupe"),
("GU", "Guam"),
("GT", "Guatemala"),
("GG", "Guernsey"),
("GN", "Guinea"),
("GW", "Guinea-Bissau"),
("GY", "Guyana"),
("HT", "Haiti"),
("HM", "Heard Island and McDonald Islands"),
("VA", "Holy See (Vatican City State)"),
("HN", "Honduras"),
("HK", "Hong Kong"),
("HU", "Hungary"),
("IS", "Iceland"),
("IN", "India"),
("ID", "Indonesia"),
("IR", "Iran, Islamic Republic of"),
("IQ", "Iraq"),
("IE", "Ireland"),
("IM", "Isle of Man"),
("IL", "Israel"),
("IT", "Italy"),
("JM", "Jamaica"),
("JP", "Japan"),
("JE", "Jersey"),
("JO", "Jordan"),
("KZ", "Kazakhstan"),
("KE", "Kenya"),
("KI", "Kiribati"),
("KP", "Korea, Democratic People's Republic of"),
("KR", "Korea, Republic of"),
("KW", "Kuwait"),
("KG", "Kyrgyzstan"),
("LA", "Lao People's Democratic Republic"),
("LV", "Latvia"),
("LB", "Lebanon"),
("LS", "Lesotho"),
("LR", "Liberia"),
("LY", "Libyan Arab Jamahiriya"),
("LI", "Liechtenstein"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("MO", "Macao"),
("MK", "Macedonia, The Former Yugoslav Republic of"),
("MG", "Madagascar"),
("MW", "Malawi"),
("MY", "Malaysia"),
("MV", "Maldives"),
("ML", "Mali"),
("MT", "Malta"),
("MH", "Marshall Islands"),
("MQ", "Martinique"),
("MR", "Mauritania"),
("MU", "Mauritius"),
("YT", "Mayotte"),
("MX", "Mexico"),
("FM", "Micronesia, Federated States of"),
("MD", "Moldova"),
("MC", "Monaco"),
("MN", "Mongolia"),
("ME", "Montenegro"),
("MS", "Montserrat"),
("MA", "Morocco"),
("MZ", "Mozambique"),
("MM", "Myanmar"),
("NA", "Namibia"),
("NR", "Nauru"),
("NP", "Nepal"),
("NL", "Netherlands"),
("AN", "Netherlands Antilles"),
("NC", "New Caledonia"),
("NZ", "New Zealand"),
("NI", "Nicaragua"),
("NE", "Niger"),
("NG", "Nigeria"),
("NU", "Niue"),
("NF", "Norfolk Island"),
("MP", "Northern Mariana Islands"),
("NO", "Norway"),
("OM", "Oman"),
("PK", "Pakistan"),
("PW", "Palau"),
("PS", "Palestinian Territory, Occupied"),
("PA", "Panama"),
("PG", "Papua New Guinea"),
("PY", "Paraguay"),
("PE", "Peru"),
("PH", "Philippines"),
("PN", "Pitcairn"),
("PL", "Poland"),
("PT", "Portugal"),
("PR", "Puerto Rico"),
("QA", "Qatar"),
("RE", "Reunion"),
("RO", "Romania"),
("RU", "Russian Federation"),
("RW", "Rwanda"),
("BL", "Saint Barthelemy"),
("SH", "Saint Helena"),
("KN", "Saint Kitts and Nevis"),
("LC", "Saint Lucia"),
("MF", "Saint Martin"),
("PM", "Saint Pierre and Miquelon"),
("VC", "Saint Vincent and the Grenadines"),
("WS", "Samoa"),
("SM", "San Marino"),
("ST", "Sao Tome and Principe"),
("SA", "Saudi Arabia"),
("SN", "Senegal"),
("RS", "Serbia"),
("SC", "Seychelles"),
("SL", "Sierra Leone"),
("SG", "Singapore"),
("SK", "Slovakia"),
("SI", "Slovenia"),
("SB", "Solomon Islands"),
("SO", "Somalia"),
("ZA", "South Africa"),
("GS", "South Georgia and the South Sandwich Islands"),
("ES", "Spain"),
("LK", "Sri Lanka"),
("SD", "Sudan"),
("SR", "Suriname"),
("SJ", "Svalbard and Jan Mayen"),
("SZ", "Swaziland"),
("SE", "Sweden"),
("CH", "Switzerland"),
("SY", "Syrian Arab Republic"),
("TW", "Taiwan, Province of China"),
("TJ", "Tajikistan"),
("TZ", "Tanzania, United Republic of"),
("TH", "Thailand"),
("TL", "Timor-Leste"),
("TG", "Togo"),
("TK", "Tokelau"),
("TO", "Tonga"),
("TT", "Trinidad and Tobago"),
("TN", "Tunisia"),
("TR", "Turkey"),
("TM", "Turkmenistan"),
("TC", "Turks and Caicos Islands"),
("TV", "Tuvalu"),
("UG", "Uganda"),
("UA", "Ukraine"),
("AE", "United Arab Emirates"),
("US", "United States"),
("UM", "United States Minor Outlying Islands"),
("UY", "Uruguay"),
("UZ", "Uzbekistan"),
("VU", "Vanuatu"),
("VE", "Venezuela"),
("VN", "Viet Nam"),
("VG", "Virgin Islands, British"),
("VI", "Virgin Islands, U.S."),
("WF", "Wallis and Futuna"),
("EH", "Western Sahara"),
("YE", "Yemen"),
("ZM", "Zambia"),
("ZW", "Zimbabwe"),
],
max_length=3,
null=True,
),
),
migrations.AddField(
model_name="account",
name="billing_postcode",
field=models.CharField(
blank=True, max_length=64, null=True, verbose_name="Post/Zip-code"
),
),
migrations.AddField(
model_name="account",
name="billing_state",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="State"
),
),
migrations.AddField(
model_name="account",
name="billing_street",
field=models.CharField(
blank=True, max_length=55, null=True, verbose_name="Street"
),
),
migrations.AddField(
model_name="account",
name="contact_name",
field=models.CharField(
default=1, max_length=120, verbose_name="Contact Name"
),
preserve_default=False,
),
]

View file

@ -1,50 +0,0 @@
# Generated by Django 2.1.7 on 2019-04-30 08:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contacts", "0003_merge_20190214_1427"),
("accounts", "0006_auto_20190212_1708"),
]
operations = [
migrations.CreateModel(
name="Email",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("sent_at", models.DateTimeField(auto_now_add=True)),
("message_subject", models.TextField(null=True)),
("message_body", models.TextField(null=True)),
(
"recipient",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="recieved_email",
to="contacts.Contact",
),
),
(
"sender",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="sent_email",
to="accounts.Account",
),
),
],
),
]

View file

@ -1,22 +0,0 @@
# Generated by Django 2.1.7 on 2019-05-17 09:14
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("accounts", "0007_email"),
]
operations = [
migrations.AddField(
model_name="account",
name="assigned_to",
field=models.ManyToManyField(
related_name="account_assigned_users", to=settings.AUTH_USER_MODEL
),
),
]

View file

@ -1,96 +0,0 @@
# Generated by Django 2.2.3 on 2019-08-09 11:29
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contacts", "0003_merge_20190214_1427"),
("accounts", "0008_account_assigned_to"),
]
operations = [
migrations.RenameField(
model_name="email",
old_name="sent_at",
new_name="created_on",
),
migrations.RenameField(
model_name="email",
old_name="sender",
new_name="from_account",
),
migrations.RemoveField(
model_name="email",
name="recipient",
),
migrations.AddField(
model_name="email",
name="from_email",
field=models.EmailField(default=django.utils.timezone.now, max_length=254),
preserve_default=False,
),
migrations.AddField(
model_name="email",
name="recipients",
field=models.ManyToManyField(
related_name="recieved_email", to="contacts.Contact"
),
),
migrations.AddField(
model_name="email",
name="rendered_message_body",
field=models.TextField(null=True),
),
migrations.AddField(
model_name="email",
name="scheduled_date_time",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="email",
name="scheduled_later",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="email",
name="timezone",
field=models.CharField(default="UTC", max_length=100),
),
migrations.CreateModel(
name="EmailLog",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("is_sent", models.BooleanField(default=False)),
(
"contact",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="contact_email_log",
to="contacts.Contact",
),
),
(
"email",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="email_log",
to="accounts.Email",
),
),
],
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 2.2.4 on 2019-09-17 05:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("teams", "0003_auto_20190909_1621"),
("accounts", "0009_auto_20190809_1659"),
]
operations = [
migrations.AddField(
model_name="account",
name="teams",
field=models.ManyToManyField(
related_name="account_teams", to="teams.Teams"
),
),
]

View file

@ -1,25 +0,0 @@
# Generated by Django 2.2.10 on 2020-04-23 10:20
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0020_auto_20200409_1653"),
("accounts", "0010_account_teams"),
]
operations = [
migrations.AddField(
model_name="account",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.Company",
),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-23 14:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("accounts", "0011_account_company"),
]
operations = [
migrations.RemoveField(
model_name="account",
name="company",
),
]

View file

@ -1,42 +0,0 @@
# Generated by Django 3.2 on 2021-09-13 13:48
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0034_auto_20210913_1918"),
("accounts", "0012_remove_account_company"),
]
operations = [
migrations.AddField(
model_name="account",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.company",
),
),
migrations.AlterField(
model_name="account",
name="assigned_to",
field=models.ManyToManyField(
related_name="account_assigned_users", to="common.Profile"
),
),
migrations.AlterField(
model_name="account",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="account_created_by",
to="common.profile",
),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.2 on 2021-09-22 12:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("accounts", "0013_auto_20210913_1918"),
]
operations = [
migrations.RenameField(
model_name="account",
old_name="company",
new_name="org",
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.2.7 on 2021-10-06 07:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0037_alter_profile_org"),
("accounts", "0014_rename_company_account_org"),
]
operations = [
migrations.AlterField(
model_name="account",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="account_org",
to="common.org",
),
),
]

View file

@ -10,18 +10,30 @@ from common.models import Org, Profile
from common.utils import COUNTRIES, INDCHOICES
from contacts.models import Contact
from teams.models import Teams
from common.base import BaseModel
class Tags(models.Model):
class Tags(BaseModel):
name = models.CharField(max_length=20)
slug = models.CharField(max_length=20, unique=True, blank=True)
class Meta:
verbose_name = "Tag"
verbose_name_plural = "Tags"
db_table = "tags"
ordering = ("-created_at",)
def __str__(self):
return f"{self.name}"
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super().save(*args, **kwargs)
class Account(models.Model):
class Account(BaseModel):
ACCOUNT_STATUS_CHOICE = (("open", "Open"), ("close", "Close"))
@ -52,7 +64,6 @@ class Account(models.Model):
created_by = models.ForeignKey(
Profile, related_name="account_created_by", on_delete=models.SET_NULL, null=True
)
created_on = models.DateTimeField(_("Created on"), auto_now_add=True)
is_active = models.BooleanField(default=False)
tags = models.ManyToManyField(Tags, blank=True)
status = models.CharField(
@ -78,10 +89,13 @@ class Account(models.Model):
)
class Meta:
ordering = ["-created_on"]
verbose_name = "Account"
verbose_name_plural = "Accounts"
db_table = "accounts"
ordering = ("-created_at",)
def __str__(self):
return self.name
return f"{self.name}"
def get_complete_address(self):
"""Concatenates complete address."""
@ -99,7 +113,7 @@ class Account(models.Model):
@property
def created_on_arrow(self):
return arrow.get(self.created_on).humanize()
return arrow.get(self.created_at).humanize()
@property
def contact_values(self):
@ -126,7 +140,7 @@ class Account(models.Model):
return Profile.objects.filter(id__in=list(user_ids))
class Email(models.Model):
class AccountEmail(BaseModel):
from_account = models.ForeignKey(
Account, related_name="sent_email", on_delete=models.SET_NULL, null=True
)
@ -136,21 +150,34 @@ class Email(models.Model):
timezone = models.CharField(max_length=100, default="UTC")
scheduled_date_time = models.DateTimeField(null=True)
scheduled_later = models.BooleanField(default=False)
created_on = models.DateTimeField(auto_now_add=True)
from_email = models.EmailField()
rendered_message_body = models.TextField(null=True)
class Meta:
verbose_name = "Account Email"
verbose_name_plural = "Account Emails"
db_table = "account_email"
ordering = ("-created_at",)
def __str__(self):
return self.message_subject
return f"{self.message_subject}"
class EmailLog(models.Model):
class AccountEmailLog(BaseModel):
"""this model is used to track if the email is sent or not"""
email = models.ForeignKey(
Email, related_name="email_log", on_delete=models.SET_NULL, null=True
AccountEmail, related_name="email_log", on_delete=models.SET_NULL, null=True
)
contact = models.ForeignKey(
Contact, related_name="contact_email_log", on_delete=models.SET_NULL, null=True
)
is_sent = models.BooleanField(default=False)
class Meta:
verbose_name = "EmailLog"
verbose_name_plural = "EmailLogs"
db_table = "emailLogs"
ordering = ("-created_at",)
def __str__(self):
return f"{self.email.message_subject}"

View file

@ -1,8 +1,11 @@
from rest_framework import serializers
from accounts.models import Account, Email, Tags
from common.serializer import (AttachmentsSerializer, OrganizationSerializer,
ProfileSerializer)
from accounts.models import Account, AccountEmail, Tags, AccountEmailLog
from common.serializer import (
AttachmentsSerializer,
OrganizationSerializer,
ProfileSerializer,
)
from contacts.serializer import ContactSerializer
from leads.serializer import LeadSerializer
from teams.serializer import TeamsSerializer
@ -61,7 +64,7 @@ class EmailSerializer(serializers.ModelSerializer):
super().__init__(*args, **kwargs)
class Meta:
model = Email
model = AccountEmail
fields = (
"message_subject",
"message_body",
@ -95,10 +98,23 @@ class EmailLogSerializer(serializers.ModelSerializer):
email = EmailSerializer()
class Meta:
model = Email
model = AccountEmailLog
fields = ["email", "contact", "is_sent"]
class AccountReadSerializer(serializers.ModelSerializer):
class Meta:
model = Account
fields = ["name", "billing_city", "tags"]
class AccountWriteSerializer(serializers.ModelSerializer):
class Meta:
model = Account
fields = ["name","phone", "email", "billing_address_line","billing_street","billing_city", "billing_state", "billing_postcode","billing_country","contacts", "teams", "assigned_to","tags","account_attachment", "website", "status","lead"]
class AccountCreateSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
account_view = kwargs.pop("account", False)
@ -150,3 +166,15 @@ class AccountCreateSerializer(serializers.ModelSerializer):
"lead",
"contact_name",
)
class AccountDetailEditSwaggerSerializer(serializers.Serializer):
comment = serializers.CharField()
account_attachment = serializers.FileField()
class AccountCommentEditSwaggerSerializer(serializers.Serializer):
comment = serializers.CharField()
class EmailWriteSerializer(serializers.ModelSerializer):
class Meta:
model = AccountEmail
fields = ("from_email", "recipients", "message_subject","scheduled_later","timezone","scheduled_date_time","message_body")

View file

@ -1,113 +0,0 @@
from drf_yasg import openapi
organization_params_in_header = openapi.Parameter(
"org", openapi.IN_HEADER, required=True, type=openapi.TYPE_INTEGER
)
organization_params = [
organization_params_in_header,
]
account_get_params = [
organization_params_in_header,
openapi.Parameter("name", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("city", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("tags", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_post_params = [
organization_params_in_header,
openapi.Parameter(
"name", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"phone", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"email", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"billing_address_line",
openapi.IN_QUERY,
required=True,
type=openapi.TYPE_STRING,
),
openapi.Parameter(
"billing_street", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"billing_city", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"billing_state", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"billing_postcode", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"billing_country", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"contacts", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter("teams", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("assigned_to", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter(
"tags",
openapi.IN_QUERY,
type=openapi.TYPE_STRING
# type=openapi.TYPE_ARRAY, items=openapi.Items(type=openapi.TYPE_STRING)
),
openapi.Parameter("account_attachment", openapi.IN_QUERY, type=openapi.TYPE_FILE),
openapi.Parameter("website", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter(
"status", openapi.IN_QUERY, type=openapi.TYPE_STRING, enum=["open", "close"]
),
openapi.Parameter("lead", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_detail_get_params = [
organization_params_in_header,
openapi.Parameter(
"account_attachment",
openapi.IN_QUERY,
type=openapi.TYPE_FILE,
),
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_comment_edit_params = [
organization_params_in_header,
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_detail_get_params = [
organization_params_in_header,
openapi.Parameter(
"account_attachment",
openapi.IN_QUERY,
type=openapi.TYPE_FILE,
),
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_comment_edit_params = [
organization_params_in_header,
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
account_mail_params = [
organization_params_in_header,
openapi.Parameter("from_email", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("recipients", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("message_subject", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("scheduled_later", openapi.IN_QUERY, type=openapi.TYPE_BOOLEAN),
openapi.Parameter("timezone", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter(
"scheduled_date_time",
openapi.IN_QUERY,
type=openapi.FORMAT_DATETIME,
example="2021-01-01 00:00",
),
openapi.Parameter("message_body", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]

View file

@ -0,0 +1,19 @@
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter
organization_params_in_header = organization_params_in_header = OpenApiParameter(
"org", OpenApiTypes.STR, OpenApiParameter.HEADER
)
organization_params = [
organization_params_in_header,
]
account_get_params = [
organization_params_in_header,
OpenApiParameter("name", OpenApiTypes.STR, OpenApiParameter.QUERY),
OpenApiParameter("city", OpenApiTypes.STR, OpenApiParameter.QUERY),
OpenApiParameter("tags", OpenApiTypes.STR, OpenApiParameter.QUERY),
]

View file

@ -7,7 +7,7 @@ from django.core.mail import EmailMessage
from django.template import Context, Template
from django.template.loader import render_to_string
from accounts.models import Account, Email, EmailLog
from accounts.models import Account, AccountEmail, AccountEmailLog
from common.models import Profile
from common.utils import convert_to_custom_timezone

View file

@ -4,8 +4,11 @@ from django.test import TestCase
from django.test.utils import override_settings
from accounts.models import Email
from accounts.tasks import (send_email, send_email_to_assigned_user,
send_scheduled_emails)
from accounts.tasks import (
send_email,
send_email_to_assigned_user,
send_scheduled_emails,
)
from accounts.tests import AccountCreateTest

View file

@ -2,20 +2,29 @@ import json
from django.db.models import Q
from django.shortcuts import get_object_or_404
from drf_yasg.utils import swagger_auto_schema
from drf_rw_serializers import generics
from drf_spectacular.utils import OpenApiExample, OpenApiParameter, extend_schema
from rest_framework import status
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.generics import GenericAPIView
from accounts import swagger_params
from accounts import swagger_params1
from accounts.models import Account, Tags
from accounts.serializer import (
AccountCreateSerializer,
AccountSerializer,
EmailSerializer,
TagsSerailizer,
AccountReadSerializer,
AccountWriteSerializer,
AccountDetailEditSwaggerSerializer,
AccountCommentEditSwaggerSerializer,
EmailWriteSerializer
)
from accounts.tasks import send_email, send_email_to_assigned_user
from cases.serializer import CaseSerializer
@ -48,10 +57,11 @@ class AccountsListView(APIView, LimitOffsetPagination):
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
model = Account
serializer_class = AccountReadSerializer
def get_context_data(self, **kwargs):
params = self.request.post_data
queryset = self.model.objects.filter(org=self.request.org).order_by("-id")
params = self.request.query_params
queryset = self.model.objects.filter(org=self.request.profile.org).order_by("-id")
if self.request.profile.role != "ADMIN" and not self.request.profile.is_admin:
queryset = queryset.filter(
Q(created_by=self.request.profile) | Q(assigned_to=self.request.profile)
@ -116,33 +126,29 @@ class AccountsListView(APIView, LimitOffsetPagination):
return context
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_get_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.account_get_params)
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return Response(context)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_post_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params,request=AccountWriteSerializer)
def post(self, request, *args, **kwargs):
params = request.post_data
data = request.data
serializer = AccountCreateSerializer(
data=params, request_obj=request, account=True
data=data, request_obj=request, account=True
)
# Save Account
if serializer.is_valid():
account_object = serializer.save(
created_by=request.profile, org=request.org
created_by=request.profile, org=request.profile.org
)
if params.get("contacts"):
contacts_list = json.loads(params.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.org)
if data.get("contacts"):
contacts_list = json.loads(data.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.profile.org)
if contacts:
account_object.contacts.add(*contacts)
if params.get("tags"):
tags = json.loads(params.get("tags"))
if data.get("tags"):
tags = json.loads(data.get("tags"))
for tag in tags:
tag_obj = Tags.objects.filter(slug=tag.lower())
if tag_obj.exists():
@ -150,15 +156,15 @@ class AccountsListView(APIView, LimitOffsetPagination):
else:
tag_obj = Tags.objects.create(name=tag)
account_object.tags.add(tag_obj)
if params.get("teams"):
teams_list = json.loads(params.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.org)
if data.get("teams"):
teams_list = json.loads(data.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if teams:
account_object.teams.add(*teams)
if params.get("assigned_to"):
assigned_to_list = json.loads(params.get("assigned_to"))
if data.get("assigned_to"):
assigned_to_list = json.loads(data.get("assigned_to"))
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.org, is_active=True
id__in=assigned_to_list, org=request.profile.org, is_active=True
)
if profiles:
account_object.assigned_to.add(*profiles)
@ -191,24 +197,24 @@ class AccountsListView(APIView, LimitOffsetPagination):
class AccountDetailView(APIView):
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
serializer_class = AccountReadSerializer
def get_object(self, pk):
return get_object_or_404(Account, id=pk)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_post_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params,request=AccountWriteSerializer)
def put(self, request, pk, format=None):
params = request.post_data
data = request.data
account_object = self.get_object(pk=pk)
if account_object.org != request.org:
if account_object.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
)
serializer = AccountCreateSerializer(
account_object, data=params, request_obj=request, account=True
account_object, data=data, request_obj=request, account=True
)
serializer.data['org'] = request.profile.org
if serializer.is_valid():
if (
@ -232,15 +238,15 @@ class AccountDetailView(APIView):
)
account_object.contacts.clear()
if params.get("contacts"):
contacts_list = json.loads(params.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.org)
if data.get("contacts"):
contacts_list = json.loads(data.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.profile.org)
if contacts:
account_object.contacts.add(*contacts)
account_object.tags.clear()
if params.get("tags"):
tags = json.loads(params.get("tags"))
if data.get("tags"):
tags = json.loads(data.get("tags"))
for tag in tags:
tag_obj = Tags.objects.filter(slug=tag.lower())
if tag_obj.exists():
@ -250,17 +256,17 @@ class AccountDetailView(APIView):
account_object.tags.add(tag_obj)
account_object.teams.clear()
if params.get("teams"):
teams_list = json.loads(params.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.org)
if data.get("teams"):
teams_list = json.loads(data.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if teams:
account_object.teams.add(*teams)
account_object.assigned_to.clear()
if params.get("assigned_to"):
assigned_to_list = json.loads(params.get("assigned_to"))
if data.get("assigned_to"):
assigned_to_list = json.loads(data.get("assigned_to"))
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.org, is_active=True
id__in=assigned_to_list, org=request.profile.org, is_active=True
)
if profiles:
account_object.assigned_to.add(*profiles)
@ -290,12 +296,10 @@ class AccountDetailView(APIView):
status=status.HTTP_400_BAD_REQUEST,
)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.organization_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params)
def delete(self, request, pk, format=None):
self.object = self.get_object(pk)
if self.object.org != request.org:
if self.object.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
@ -315,12 +319,10 @@ class AccountDetailView(APIView):
status=status.HTTP_200_OK,
)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.organization_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params)
def get(self, request, pk, format=None):
self.account = self.get_object(pk=pk)
if self.account.org != request.org:
if self.account.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_404_NOT_FOUND,
@ -350,13 +352,13 @@ class AccountDetailView(APIView):
if self.request.profile.is_admin or self.request.profile.role == "ADMIN":
users_mention = list(
Profile.objects.filter(is_active=True, org=self.request.org).values(
"user__username"
Profile.objects.filter(is_active=True, org=self.request.profile.org).values(
"user__email"
)
)
elif self.request.profile != self.account.created_by:
if self.account.created_by:
users_mention = [{"username": self.account.created_by.user.username}]
users_mention = [{"username": self.account.created_by.user.email}]
else:
users_mention = []
else:
@ -377,7 +379,7 @@ class AccountDetailView(APIView):
).data,
"users": ProfileSerializer(
Profile.objects.filter(
is_active=True, org=self.request.org
is_active=True, org=self.request.profile.org
).order_by("user__email"),
many=True,
).data,
@ -406,14 +408,14 @@ class AccountDetailView(APIView):
)
return Response(context)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_detail_get_params
@extend_schema(
tags=["Accounts"], parameters=swagger_params1.organization_params,request=AccountDetailEditSwaggerSerializer
)
def post(self, request, pk, **kwargs):
params = request.post_data
data = request.data
context = {}
self.account_obj = Account.objects.get(pk=pk)
if self.account_obj.org != request.org:
if self.account_obj.org != request.profile.org:
return Response(
{
"error": True,
@ -433,9 +435,9 @@ class AccountDetailView(APIView):
},
status=status.HTTP_403_FORBIDDEN,
)
comment_serializer = CommentSerializer(data=params)
comment_serializer = CommentSerializer(data=data)
if comment_serializer.is_valid():
if params.get("comment"):
if data.get("comment"):
comment_serializer.save(
account_id=self.account_obj.id,
commented_by=self.request.profile,
@ -469,23 +471,24 @@ class AccountCommentView(APIView):
model = Comment
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
serializer_class = AccountCommentEditSwaggerSerializer
def get_object(self, pk):
return self.model.objects.get(pk=pk)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_comment_edit_params
@extend_schema(
tags=["Accounts"], parameters=swagger_params1.organization_params,request=AccountCommentEditSwaggerSerializer
)
def put(self, request, pk, format=None):
params = request.post_data
data = request.data
obj = self.get_object(pk)
if (
request.profile.role == "ADMIN"
or request.profile.is_admin
or request.profile == obj.commented_by
):
serializer = CommentSerializer(obj, data=params)
if params.get("comment"):
serializer = CommentSerializer(obj, data=data)
if data.get("comment"):
if serializer.is_valid():
serializer.save()
return Response(
@ -504,9 +507,7 @@ class AccountCommentView(APIView):
status=status.HTTP_403_FORBIDDEN,
)
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.organization_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params)
def delete(self, request, pk, format=None):
self.object = self.get_object(pk)
if (
@ -532,10 +533,9 @@ class AccountAttachmentView(APIView):
model = Attachments
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
serializer_class = AccountDetailEditSwaggerSerializer
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.organization_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params)
def delete(self, request, pk, format=None):
self.object = self.model.objects.get(pk=pk)
if (
@ -561,17 +561,16 @@ class AccountCreateMailView(APIView):
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
model = Account
serializer_class = EmailWriteSerializer
@swagger_auto_schema(
tags=["Accounts"], manual_parameters=swagger_params.account_mail_params
)
@extend_schema(tags=["Accounts"], parameters=swagger_params1.organization_params,request=EmailWriteSerializer)
def post(self, request, pk, *args, **kwargs):
params = request.post_data
scheduled_later = params.get("scheduled_later")
scheduled_date_time = params.get("scheduled_date_time")
data = request.data
scheduled_later = data.get("scheduled_later")
scheduled_date_time = data.get("scheduled_date_time")
account = Account.objects.filter(id=pk).first()
serializer = EmailSerializer(
data=params,
data=data,
request_obj=request, # account=account,
)
@ -585,17 +584,17 @@ class AccountCreateMailView(APIView):
status=status.HTTP_400_BAD_REQUEST,
)
if params.get("recipients"):
contacts = json.loads(params.get("recipients"))
if data.get("recipients"):
contacts = json.loads(data.get("recipients"))
for contact in contacts:
obj_contact = Contact.objects.filter(id=contact, org=request.org)
obj_contact = Contact.objects.filter(id=contact, org=request.profile.org)
if obj_contact.exists():
email_obj.recipients.add(contact)
else:
email_obj.delete()
data["recipients"] = "Please enter valid recipient"
return Response({"error": True, "errors": data})
if params.get("scheduled_later") != "true":
if data.get("scheduled_later") != "true":
send_email.delay(email_obj.id)
else:
email_obj.scheduled_later = True

View file

@ -1,7 +1,8 @@
# Generated by Django 2.1.2 on 2019-01-28 07:07
# Generated by Django 4.2.1 on 2023-06-19 13:08
import django.db.models.deletion
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
@ -9,82 +10,30 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
("accounts", "0001_initial"),
('accounts', '0001_initial'),
]
operations = [
migrations.CreateModel(
name="Case",
name='Case',
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=64, verbose_name="Name")),
(
"status",
models.CharField(
choices=[
("New", "New"),
("Assigned", "Assigned"),
("Pending", "Pending"),
("Closed", "Closed"),
("Rejected", "Rejected"),
("Duplicate", "Duplicate"),
],
max_length=64,
),
),
(
"priority",
models.CharField(
choices=[
("Low", "Low"),
("Normal", "Normal"),
("High", "High"),
("Urgent", "Urgent"),
],
max_length=64,
),
),
(
"case_type",
models.CharField(
blank=True,
choices=[
("Question", "Question"),
("Incident", "Incident"),
("Problem", "Problem"),
],
default="",
max_length=255,
null=True,
),
),
("closed_on", models.DateField()),
("description", models.TextField(blank=True, null=True)),
(
"created_on",
models.DateTimeField(auto_now_add=True, verbose_name="Created on"),
),
("is_active", models.BooleanField(default=False)),
(
"account",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="accounts.Account",
),
),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Last Modified At')),
('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=64, verbose_name='Name')),
('status', models.CharField(choices=[('New', 'New'), ('Assigned', 'Assigned'), ('Pending', 'Pending'), ('Closed', 'Closed'), ('Rejected', 'Rejected'), ('Duplicate', 'Duplicate')], max_length=64)),
('priority', models.CharField(choices=[('Low', 'Low'), ('Normal', 'Normal'), ('High', 'High'), ('Urgent', 'Urgent')], max_length=64)),
('case_type', models.CharField(blank=True, choices=[('Question', 'Question'), ('Incident', 'Incident'), ('Problem', 'Problem')], default='', max_length=255, null=True)),
('closed_on', models.DateField()),
('description', models.TextField(blank=True, null=True)),
('is_active', models.BooleanField(default=False)),
('account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='accounts_cases', to='accounts.account')),
],
options={
"ordering": ["-created_on"],
'verbose_name': 'Case',
'verbose_name_plural': 'Cases',
'db_table': 'case',
'ordering': ('-created_at',),
},
),
]

View file

@ -1,46 +0,0 @@
# Generated by Django 2.1.2 on 2019-01-28 07:07
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("common", "0001_initial"),
("cases", "0001_initial"),
("contacts", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name="case",
name="assigned_to",
field=models.ManyToManyField(
related_name="case_assigned_users", to=settings.AUTH_USER_MODEL
),
),
migrations.AddField(
model_name="case",
name="contacts",
field=models.ManyToManyField(to="contacts.Contact"),
),
migrations.AddField(
model_name="case",
name="created_by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="case_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="case",
name="teams",
field=models.ManyToManyField(to="common.Team"),
),
]

View file

@ -0,0 +1,51 @@
# Generated by Django 4.2.1 on 2023-06-19 13:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('teams', '0001_initial'),
('contacts', '0001_initial'),
('common', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cases', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='case',
name='assigned_to',
field=models.ManyToManyField(related_name='case_assigned_users', to='common.profile'),
),
migrations.AddField(
model_name='case',
name='contacts',
field=models.ManyToManyField(to='contacts.contact'),
),
migrations.AddField(
model_name='case',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_created_by', to='common.profile'),
),
migrations.AddField(
model_name='case',
name='org',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_org', to='common.org'),
),
migrations.AddField(
model_name='case',
name='teams',
field=models.ManyToManyField(related_name='cases_teams', to='teams.teams'),
),
migrations.AddField(
model_name='case',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
]

View file

@ -1,29 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-12 08:04
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("cases", "0002_auto_20190128_1237"),
]
operations = [
migrations.RemoveField(
model_name="case",
name="teams",
),
migrations.AlterField(
model_name="case",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="case_created_by",
to=settings.AUTH_USER_MODEL,
),
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 2.2.4 on 2019-09-17 05:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("teams", "0003_auto_20190909_1621"),
("cases", "0003_auto_20190212_1334"),
]
operations = [
migrations.AddField(
model_name="case",
name="teams",
field=models.ManyToManyField(related_name="cases_teams", to="teams.Teams"),
),
]

View file

@ -1,25 +0,0 @@
# Generated by Django 2.2.10 on 2020-04-27 12:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0021_document_company"),
("cases", "0004_case_teams"),
]
operations = [
migrations.AddField(
model_name="case",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.Company",
),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-23 12:17
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0011_account_company"),
("cases", "0005_case_company"),
]
operations = [
migrations.AlterField(
model_name="case",
name="account",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="accounts_cases",
to="accounts.account",
),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-24 04:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("cases", "0006_auto_20210323_1747"),
]
operations = [
migrations.RemoveField(
model_name="case",
name="company",
),
]

View file

@ -1,42 +0,0 @@
# Generated by Django 3.2 on 2021-09-13 13:48
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0034_auto_20210913_1918"),
("cases", "0007_remove_case_company"),
]
operations = [
migrations.AddField(
model_name="case",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.company",
),
),
migrations.AlterField(
model_name="case",
name="assigned_to",
field=models.ManyToManyField(
related_name="case_assigned_users", to="common.Profile"
),
),
migrations.AlterField(
model_name="case",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="case_created_by",
to="common.profile",
),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.2 on 2021-09-22 12:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("cases", "0008_auto_20210913_1918"),
]
operations = [
migrations.RenameField(
model_name="case",
old_name="company",
new_name="org",
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 3.2.7 on 2021-10-06 07:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0037_alter_profile_org"),
("cases", "0009_rename_company_case_org"),
]
operations = [
migrations.AlterField(
model_name="case",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="case_org",
to="common.org",
),
),
]

View file

@ -6,13 +6,14 @@ from django.utils.translation import pgettext_lazy
from accounts.models import Account
from common.models import Org, Profile
from common.base import BaseModel
from common.utils import CASE_TYPE, PRIORITY_CHOICE, STATUS_CHOICE
from contacts.models import Contact
from planner.models import Event
from planner.models import PlannerEvent as Event
from teams.models import Teams
class Case(models.Model):
class Case(BaseModel):
name = models.CharField(pgettext_lazy("Name of the case", "Name"), max_length=64)
status = models.CharField(choices=STATUS_CHOICE, max_length=64)
priority = models.CharField(choices=PRIORITY_CHOICE, max_length=64)
@ -34,7 +35,6 @@ class Case(models.Model):
created_by = models.ForeignKey(
Profile, related_name="case_created_by", on_delete=models.SET_NULL, null=True
)
created_on = models.DateTimeField(_("Created on"), auto_now_add=True)
is_active = models.BooleanField(default=False)
teams = models.ManyToManyField(Teams, related_name="cases_teams")
org = models.ForeignKey(
@ -42,10 +42,13 @@ class Case(models.Model):
)
class Meta:
ordering = ["-created_on"]
verbose_name = "Case"
verbose_name_plural = "Cases"
db_table = "case"
ordering = ("-created_at",)
def __str__(self):
return self.name
return f"{self.name}"
@property
def get_team_users(self):
@ -116,4 +119,4 @@ class Case(models.Model):
@property
def created_on_arrow(self):
return arrow.get(self.created_on).humanize()
return arrow.get(self.created_at).humanize()

View file

@ -73,3 +73,28 @@ class CaseCreateSerializer(serializers.ModelSerializer):
"org",
"created_on_arrow",
)
class CaseCreateSwaggerSerializer(serializers.ModelSerializer):
class Meta:
model = Case
fields = (
"name",
"status",
"priority",
"case_type",
"closed_on",
"teams",
"assigned_to",
"account",
"case_attachment",
"contacts",
"description",
)
class CaseDetailEditSwaggerSerializer(serializers.Serializer):
comment = serializers.CharField()
case_attachment = serializers.FileField()
class CaseCommentEditSwaggerSerializer(serializers.Serializer):
comment = serializers.CharField()

View file

@ -1,63 +0,0 @@
from drf_yasg import openapi
organization_params_in_header = openapi.Parameter(
"org", openapi.IN_HEADER, required=True, type=openapi.TYPE_INTEGER
)
organization_params = [
organization_params_in_header,
]
cases_list_get_params = [
organization_params_in_header,
openapi.Parameter("name", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("status", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("priority", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("account", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
cases_detail_get_params = [
organization_params_in_header,
openapi.Parameter(
"case_attachment",
openapi.IN_QUERY,
type=openapi.TYPE_FILE,
),
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
cases_create_post_params = [
organization_params_in_header,
openapi.Parameter(
"name", openapi.IN_QUERY, required=True, type=openapi.TYPE_STRING
),
openapi.Parameter(
"status", openapi.IN_QUERY, type=openapi.TYPE_STRING, required=True
),
openapi.Parameter(
"priority", openapi.IN_QUERY, type=openapi.TYPE_STRING, required=True
),
openapi.Parameter("type_of_case", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter(
"closed_on",
openapi.IN_QUERY,
type=openapi.TYPE_STRING,
format="date",
required=True,
),
openapi.Parameter("teams", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("assigned_to", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("account", openapi.IN_QUERY, type=openapi.TYPE_INTEGER),
openapi.Parameter(
"case_attachment",
openapi.IN_QUERY,
type=openapi.TYPE_FILE,
),
openapi.Parameter("contacts", openapi.IN_QUERY, type=openapi.TYPE_STRING),
openapi.Parameter("description", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]
cases_comment_edit_params = [
organization_params_in_header,
openapi.Parameter("comment", openapi.IN_QUERY, type=openapi.TYPE_STRING),
]

18
cases/swagger_params1.py Normal file
View file

@ -0,0 +1,18 @@
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter
organization_params_in_header = organization_params_in_header = OpenApiParameter(
"org", OpenApiTypes.STR, OpenApiParameter.HEADER
)
organization_params = [
organization_params_in_header,
]
cases_list_get_params = [
organization_params_in_header,
OpenApiParameter("name", OpenApiTypes.STR,OpenApiParameter.QUERY),
OpenApiParameter("status", OpenApiTypes.STR,OpenApiParameter.QUERY),
OpenApiParameter("priority", OpenApiTypes.STR,OpenApiParameter.QUERY),
OpenApiParameter("account", OpenApiTypes.STR,OpenApiParameter.QUERY),
]

View file

@ -1,7 +1,7 @@
import json
from django.db.models import Q
from drf_yasg.utils import swagger_auto_schema
from drf_spectacular.utils import OpenApiExample, OpenApiParameter, extend_schema
from rest_framework import status
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.permissions import IsAuthenticated
@ -10,9 +10,9 @@ from rest_framework.views import APIView
from accounts.models import Account
from accounts.serializer import AccountSerializer
from cases import swagger_params
from cases import swagger_params1
from cases.models import Case
from cases.serializer import CaseCreateSerializer, CaseSerializer
from cases.serializer import CaseCreateSerializer, CaseSerializer,CaseCreateSwaggerSerializer,CaseDetailEditSwaggerSerializer,CaseCommentEditSwaggerSerializer
from cases.tasks import send_email_to_assigned_user
from common.models import Attachments, Comment, Profile
@ -30,11 +30,11 @@ class CaseListView(APIView, LimitOffsetPagination):
model = Case
def get_context_data(self, **kwargs):
params = self.request.post_data
queryset = self.model.objects.filter(org=self.request.org).order_by("-id")
accounts = Account.objects.filter(org=self.request.org).order_by("-id")
contacts = Contact.objects.filter(org=self.request.org).order_by("-id")
profiles = Profile.objects.filter(is_active=True, org=self.request.org)
params = self.request.query_params
queryset = self.model.objects.filter(org=self.request.profile.org).order_by("-id")
accounts = Account.objects.filter(org=self.request.profile.org).order_by("-id")
contacts = Contact.objects.filter(org=self.request.profile.org).order_by("-id")
profiles = Profile.objects.filter(is_active=True, org=self.request.profile.org)
if self.request.profile.role != "ADMIN" and not self.request.profile.is_admin:
queryset = queryset.filter(
Q(created_by=self.request.profile) | Q(assigned_to=self.request.profile)
@ -82,43 +82,43 @@ class CaseListView(APIView, LimitOffsetPagination):
context["contacts_list"] = ContactSerializer(contacts, many=True).data
return context
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.cases_list_get_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.cases_list_get_params
)
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return Response(context)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.cases_create_post_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params,request=CaseCreateSwaggerSerializer
)
def post(self, request, *args, **kwargs):
params = request.post_data
params = request.data
serializer = CaseCreateSerializer(data=params, request_obj=request)
if serializer.is_valid():
cases_obj = serializer.save(
created_by=request.profile,
org=request.org,
org=request.profile.org,
closed_on=params.get("closed_on"),
case_type=params.get("type_of_case"),
case_type=params.get("case_type"),
)
if params.get("contacts"):
contacts_list = json.loads(params.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.org)
contacts = Contact.objects.filter(id__in=contacts_list, org=request.profile.org)
if contacts:
cases_obj.contacts.add(*contacts)
if params.get("teams"):
teams_list = json.loads(params.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.org)
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if teams.exists():
cases_obj.teams.add(*teams)
if params.get("assigned_to"):
assinged_to_list = json.loads(params.get("assigned_to"))
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.org, is_active=True
id__in=assinged_to_list, org=request.profile.org, is_active=True
)
if profiles:
cases_obj.assigned_to.add(*profiles)
@ -155,13 +155,13 @@ class CaseDetailView(APIView):
def get_object(self, pk):
return self.model.objects.filter(id=pk).first()
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.cases_create_post_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params,request=CaseCreateSwaggerSerializer
)
def put(self, request, pk, format=None):
params = request.post_data
params = request.data
cases_object = self.get_object(pk=pk)
if cases_object.org != request.org:
if cases_object.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
@ -187,7 +187,7 @@ class CaseDetailView(APIView):
if serializer.is_valid():
cases_object = serializer.save(
closed_on=params.get("closed_on"), case_type=params.get("type_of_case")
closed_on=params.get("closed_on"), case_type=params.get("case_type")
)
previous_assigned_to_users = list(
cases_object.assigned_to.all().values_list("id", flat=True)
@ -195,14 +195,14 @@ class CaseDetailView(APIView):
cases_object.contacts.clear()
if params.get("contacts"):
contacts_list = json.loads(params.get("contacts"))
contacts = Contact.objects.filter(id__in=contacts_list, org=request.org)
contacts = Contact.objects.filter(id__in=contacts_list, org=request.profile.org)
if contacts:
cases_object.contacts.add(*contacts)
cases_object.teams.clear()
if params.get("teams"):
teams_list = json.loads(params.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.org)
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if teams.exists():
cases_object.teams.add(*teams)
@ -210,7 +210,7 @@ class CaseDetailView(APIView):
if params.get("assigned_to"):
assinged_to_list = json.loads(params.get("assigned_to"))
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.org, is_active=True
id__in=assinged_to_list, org=request.profile.org, is_active=True
)
if profiles:
cases_object.assigned_to.add(*profiles)
@ -240,12 +240,12 @@ class CaseDetailView(APIView):
status=status.HTTP_400_BAD_REQUEST,
)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.organization_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params
)
def delete(self, request, pk, format=None):
self.object = self.get_object(pk)
if self.object.org != request.org:
if self.object.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
@ -265,12 +265,12 @@ class CaseDetailView(APIView):
status=status.HTTP_200_OK,
)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.organization_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params
)
def get(self, request, pk, format=None):
self.cases = self.get_object(pk=pk)
if self.cases.org != request.org:
if self.cases.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
@ -301,13 +301,13 @@ class CaseDetailView(APIView):
if self.request.profile.is_admin or self.request.profile.role == "ADMIN":
users_mention = list(
Profile.objects.filter(is_active=True, org=self.request.org).values(
"user__username"
Profile.objects.filter(is_active=True, org=self.request.profile.org).values(
"user__email"
)
)
elif self.request.profile != self.cases.created_by:
if self.cases.created_by:
users_mention = [{"username": self.cases.created_by.user.username}]
users_mention = [{"username": self.cases.created_by.user.email}]
else:
users_mention = []
else:
@ -332,13 +332,13 @@ class CaseDetailView(APIView):
)
return Response(context)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.cases_detail_get_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params,request=CaseDetailEditSwaggerSerializer
)
def post(self, request, pk, **kwargs):
params = request.post_data
params = request.data
self.cases_obj = Case.objects.get(pk=pk)
if self.cases_obj.org != request.org:
if self.cases_obj.org != request.profile.org:
return Response(
{"error": True, "errors": "User company doesnot match with header...."},
status=status.HTTP_403_FORBIDDEN,
@ -393,11 +393,11 @@ class CaseCommentView(APIView):
def get_object(self, pk):
return self.model.objects.get(pk=pk)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.cases_comment_edit_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params,request=CaseCommentEditSwaggerSerializer
)
def put(self, request, pk, format=None):
params = request.post_data
params = request.data
obj = self.get_object(pk)
if (
request.profile.role == "ADMIN"
@ -424,8 +424,8 @@ class CaseCommentView(APIView):
status=status.HTTP_403_FORBIDDEN,
)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.organization_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params
)
def delete(self, request, pk, format=None):
self.object = self.get_object(pk)
@ -453,8 +453,8 @@ class CaseAttachmentView(APIView):
# authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
@swagger_auto_schema(
tags=["Cases"], manual_parameters=swagger_params.organization_params
@extend_schema(
tags=["Cases"], parameters=swagger_params1.organization_params
)
def delete(self, request, pk, format=None):
self.object = self.model.objects.get(pk=pk)

View file

@ -2,5 +2,5 @@ from django.apps import AppConfig
class CmsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'cms'
default_auto_field = "django.db.models.BigAutoField"
name = "cms"

View file

@ -1,9 +1,9 @@
from django.db import models
from modelcluster.models import ClusterableModel
from wagtail.blocks import CharBlock, ListBlock, RichTextBlock, TextBlock
from wagtail.core import blocks
from wagtail.core.blocks import StructBlock
from wagtail.core.models import Orderable
from wagtail import blocks
from wagtail.blocks import StructBlock
from wagtail.models import Orderable
from wagtail.fields import RichTextField
from wagtail.images.blocks import ImageChooserBlock
from wagtail.snippets.blocks import SnippetChooserBlock

View file

@ -1,12 +1,14 @@
# Generated by Django 4.1.1 on 2022-10-11 12:11
# Generated by Django 4.2.1 on 2023-06-19 13:08
import cms.blocks
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import modelcluster.fields
import wagtail.blocks
import wagtail.contrib.routable_page.models
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations, models
class Migration(migrations.Migration):
@ -14,11 +16,34 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0077_alter_revision_user'),
('wagtailimages', '0024_index_image_file_hash'),
('wagtailcore', '0083_workflowcontenttype'),
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
]
operations = [
migrations.CreateModel(
name='BlogDetailPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('excerpt', wagtail.fields.RichTextField()),
('content', wagtail.fields.StreamField([('content_title', cms.blocks.BlogContentTitleBlock()), ('code', cms.blocks.BlogCodeBlock()), ('rich_text', cms.blocks.BlogRichTextBlock()), ('image', cms.blocks.BlogImageBlock())], null=True, use_json_field=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='BlogListPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('intro', wagtail.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=(wagtail.contrib.routable_page.models.RoutablePageMixin, 'wagtailcore.page'),
),
migrations.CreateModel(
name='HomePage',
fields=[

View file

@ -1,41 +0,0 @@
# Generated by Django 4.1.1 on 2022-10-31 06:50
from django.db import migrations, models
import django.db.models.deletion
import wagtail.contrib.routable_page.models
import wagtail.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0077_alter_revision_user'),
('cms', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BlogDetailPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('excerpt', wagtail.fields.RichTextField()),
('show_legend', models.BooleanField(default=False)),
('content', wagtail.fields.StreamField([], use_json_field=None)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='BlogListPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('intro', wagtail.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=(wagtail.contrib.routable_page.models.RoutablePageMixin, 'wagtailcore.page'),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 4.1.1 on 2022-10-31 09:01
import cms.blocks
from django.db import migrations
import wagtail.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0002_blogdetailpage_bloglistpage'),
]
operations = [
migrations.RemoveField(
model_name='blogdetailpage',
name='show_legend',
),
migrations.AlterField(
model_name='blogdetailpage',
name='content',
field=wagtail.fields.StreamField([('content_title', cms.blocks.BlogContentTitleBlock()), ('code', cms.blocks.BlogCodeBlock()), ('rich_text', cms.blocks.BlogRichTextBlock()), ('image', cms.blocks.BlogImageBlock())], use_json_field=None),
),
]

View file

@ -1,20 +1,24 @@
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.shortcuts import render
from django.utils.translation import gettext_lazy as _
from django_extensions.db.fields import AutoSlugField
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.admin.edit_handlers import (FieldPanel, InlinePanel,
MultiFieldPanel, PageChooserPanel)
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Orderable, Page
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.models import register_snippet
from wagtail.admin.panels import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
)
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
from wagtail import blocks
from wagtail.fields import StreamField
from wagtail.models import Orderable, Page
from wagtail.fields import RichTextField
from django.shortcuts import render
# from wagtail.images. import ImageChooserPanel
from wagtail.snippets.models import register_snippet
from cms import blocks

View file

@ -1,10 +1,10 @@
from django.contrib import admin
from common.models import Address, Comment, Comment_Files, User
from common.models import Address, Comment, CommentFiles, User
# Register your models here.
admin.site.register(User)
admin.site.register(Address)
admin.site.register(Comment)
admin.site.register(Comment_Files)
admin.site.register(CommentFiles)

38
common/base.py Normal file
View file

@ -0,0 +1,38 @@
import uuid
# Django imports
from django.db import models
# Third party imports
from crum import get_current_user
# Module imports
from common.mixins import AuditModel
class BaseModel(AuditModel):
id = models.UUIDField(
default=uuid.uuid4, unique=True, editable=False, db_index=True, primary_key=True
)
class Meta:
abstract = True
def save(self, *args, **kwargs):
user = get_current_user()
if user is None or user.is_anonymous:
self.created_by = None
self.updated_by = None
super(BaseModel, self).save(*args, **kwargs)
else:
# Check if the model is being created or updated
if self._state.adding:
# If created only set created_by value: set updated_by to None
self.created_by = user
self.updated_by = None
# If updated only set updated_by value don't touch created_by
self.updated_by = user
super(BaseModel, self).save(*args, **kwargs)
def __str__(self):
return str(self.id)

7
common/custom_openapi.py Normal file
View file

@ -0,0 +1,7 @@
def preprocessing_filter_spec(endpoints):
filtered = []
for (path, path_regex, method, callback) in endpoints:
# Remove all but DRF API endpoints
if path.startswith("/api/"):
filtered.append((path, path_regex, method, callback))
return filtered

View file

@ -4,29 +4,36 @@ from django.contrib.auth import logout
from django.core.exceptions import ValidationError
from rest_framework import status
from rest_framework.response import Response
from crum import get_current_user
from django.utils.functional import SimpleLazyObject
from common.models import Org, Profile, User
def set_profile_request(request, org, token):
# we are decoding the token
decoded = jwt.decode(token, (settings.SECRET_KEY), algorithms=[settings.JWT_ALGO])
# def set_profile_request(request, org, token):
# # we are decoding the token
# decoded = jwt.decode(token, (settings.SECRET_KEY), algorithms=[settings.JWT_ALGO])
request.user = User.objects.get(id=decoded["user_id"])
# request.user = User.objects.get(id=decoded["user_id"])
if request.user:
request.profile = Profile.objects.get(
user=request.user, org=org, is_active=True
)
request.profile.role = "ADMIN"
request.profile.save()
if request.profile is None:
logout(request)
return Response(
{"error": False},
status=status.HTTP_200_OK,
)
# if request.user:
# request.profile = Profile.objects.get(
# user=request.user, org=org, is_active=True
# )
# request.profile.role = "ADMIN"
# request.profile.save()
# if request.profile is None:
# logout(request)
# return Response(
# {"error": False},
# status=status.HTTP_200_OK,
# )
def get_actual_value(request):
if request.user is None:
return None
return request.user #here should have value, so any code using request.user will work
class GetProfileAndOrg(object):
def __init__(self, get_response):
@ -38,18 +45,18 @@ class GetProfileAndOrg(object):
def process_request(self, request):
request.profile = None
user_id = None
# here I am getting the the jwt token passing in header
if request.headers.get("Authorization"):
token1 = request.headers.get("Authorization")
token = token1.split(" ")[1] # getting the token value
decoded = jwt.decode(token, (settings.SECRET_KEY), algorithms=[settings.JWT_ALGO])
user_id = decoded['user_id']
if user_id is not None:
if request.headers.get("org"):
org_id = request.headers.get("org")
org = Org.objects.get(id=org_id)
if org:
request.org = org
set_profile_request(request, org, token)
else:
request.org = None
else:
request.org = None
profile = Profile.objects.get(
user_id=user_id, org=request.headers.get("org"), is_active=True
)
if profile:
request.profile = profile

View file

@ -1,19 +0,0 @@
import json
class SwaggerMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request, *args, **kwargs):
request.body # just add this line BEFORE get_response
request.post_data = (
request.GET if len(request.POST) == 0 else request.POST
) # for swagger
if request.post_data == {} and request.body: # <--- for raw data (import)
request.post_data = json.loads(request.body)
response = self.get_response(request)
return response

File diff suppressed because one or more lines are too long

View file

@ -1,132 +0,0 @@
# Generated by Django 2.1.2 on 2019-01-28 07:07
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("contacts", "0001_initial"),
("common", "0001_initial"),
("opportunity", "0001_initial"),
("auth", "0009_alter_user_last_name_max_length"),
("leads", "0001_initial"),
("accounts", "0002_auto_20190128_1237"),
]
operations = [
migrations.AddField(
model_name="comment",
name="contact",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="contact_comments",
to="contacts.Contact",
),
),
migrations.AddField(
model_name="comment",
name="lead",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="leads",
to="leads.Lead",
),
),
migrations.AddField(
model_name="comment",
name="opportunity",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="opportunity_comments",
to="opportunity.Opportunity",
),
),
migrations.AddField(
model_name="attachments",
name="account",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="account_attachment",
to="accounts.Account",
),
),
migrations.AddField(
model_name="attachments",
name="contact",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="contact_attachment",
to="contacts.Contact",
),
),
migrations.AddField(
model_name="attachments",
name="created_by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="attachment_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="attachments",
name="lead",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="lead_attachment",
to="leads.Lead",
),
),
migrations.AddField(
model_name="attachments",
name="opportunity",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="opportunity_attachment",
to="opportunity.Opportunity",
),
),
migrations.AddField(
model_name="user",
name="groups",
field=models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
related_name="user_set",
related_query_name="user",
to="auth.Group",
verbose_name="groups",
),
),
migrations.AddField(
model_name="user",
name="user_permissions",
field=models.ManyToManyField(
blank=True,
help_text="Specific permissions for this user.",
related_name="user_set",
related_query_name="user",
to="auth.Permission",
verbose_name="user permissions",
),
),
]

View file

@ -0,0 +1,211 @@
# Generated by Django 4.2.1 on 2023-06-19 13:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('leads', '0001_initial'),
('invoices', '0001_initial'),
('teams', '0001_initial'),
('auth', '0012_alter_user_first_name_max_length'),
('accounts', '0002_initial'),
('opportunity', '0001_initial'),
('contacts', '0001_initial'),
('common', '0001_initial'),
('tasks', '0001_initial'),
('cases', '0002_initial'),
('events', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='document',
name='teams',
field=models.ManyToManyField(related_name='document_teams', to='teams.teams'),
),
migrations.AddField(
model_name='document',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='commentfiles',
name='comment',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.comment'),
),
migrations.AddField(
model_name='commentfiles',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='commentfiles',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='comment',
name='account',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='accounts_comments', to='accounts.account'),
),
migrations.AddField(
model_name='comment',
name='case',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cases', to='cases.case'),
),
migrations.AddField(
model_name='comment',
name='commented_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='common.profile'),
),
migrations.AddField(
model_name='comment',
name='contact',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contact_comments', to='contacts.contact'),
),
migrations.AddField(
model_name='comment',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='comment',
name='event',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='events_comments', to='events.event'),
),
migrations.AddField(
model_name='comment',
name='invoice',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='invoice_comments', to='invoices.invoice'),
),
migrations.AddField(
model_name='comment',
name='lead',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='leads_comments', to='leads.lead'),
),
migrations.AddField(
model_name='comment',
name='opportunity',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opportunity_comments', to='opportunity.opportunity'),
),
migrations.AddField(
model_name='comment',
name='profile',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_comments', to='common.profile'),
),
migrations.AddField(
model_name='comment',
name='task',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tasks_comments', to='tasks.task'),
),
migrations.AddField(
model_name='comment',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='attachments',
name='account',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='account_attachment', to='accounts.account'),
),
migrations.AddField(
model_name='attachments',
name='case',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='case_attachment', to='cases.case'),
),
migrations.AddField(
model_name='attachments',
name='contact',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contact_attachment', to='contacts.contact'),
),
migrations.AddField(
model_name='attachments',
name='created_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='attachment_created_by', to='common.profile'),
),
migrations.AddField(
model_name='attachments',
name='event',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='events_attachment', to='events.event'),
),
migrations.AddField(
model_name='attachments',
name='invoice',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='invoice_attachment', to='invoices.invoice'),
),
migrations.AddField(
model_name='attachments',
name='lead',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='lead_attachment', to='leads.lead'),
),
migrations.AddField(
model_name='attachments',
name='opportunity',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opportunity_attachment', to='opportunity.opportunity'),
),
migrations.AddField(
model_name='attachments',
name='task',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tasks_attachment', to='tasks.task'),
),
migrations.AddField(
model_name='attachments',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='apisettings',
name='created_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='settings_created_by', to='common.profile'),
),
migrations.AddField(
model_name='apisettings',
name='lead_assigned_to',
field=models.ManyToManyField(related_name='lead_assignee_users', to='common.profile'),
),
migrations.AddField(
model_name='apisettings',
name='org',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='org_api_settings', to='common.org'),
),
migrations.AddField(
model_name='apisettings',
name='tags',
field=models.ManyToManyField(blank=True, to='accounts.tags'),
),
migrations.AddField(
model_name='apisettings',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='address',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By'),
),
migrations.AddField(
model_name='address',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_by', to=settings.AUTH_USER_MODEL, verbose_name='Last Modified By'),
),
migrations.AddField(
model_name='user',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups'),
),
migrations.AddField(
model_name='user',
name='user_permissions',
field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions'),
),
migrations.AlterUniqueTogether(
name='profile',
unique_together={('user', 'org')},
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.2.1 on 2023-07-12 09:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('common', '0002_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='profile_pic',
field=models.CharField(blank=True, max_length=1000, null=True),
),
]

View file

@ -1,47 +0,0 @@
# Generated by Django 2.1.5 on 2019-01-28 07:28
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import common.models
class Migration(migrations.Migration):
dependencies = [
("common", "0002_auto_20190128_1237"),
]
operations = [
migrations.CreateModel(
name="Document",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(blank=True, max_length=1000, null=True)),
(
"document_file",
models.FileField(
max_length=5000, upload_to=common.models.document_path
),
),
("created_on", models.DateTimeField(auto_now_add=True)),
(
"created_by",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="document_uploaded",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 4.2.1 on 2023-07-21 11:23
from django.db import migrations
import phonenumber_field.modelfields
class Migration(migrations.Migration):
dependencies = [
('common', '0003_alter_user_profile_pic'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='alternate_phone',
field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None),
),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 2.1.5 on 2019-01-29 08:02
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("cases", "0002_auto_20190128_1237"),
("common", "0003_document"),
]
operations = [
migrations.AddField(
model_name="attachments",
name="case",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="case_attachment",
to="cases.Case",
),
),
]

View file

@ -1,34 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-04 08:30
from django.db import migrations, models
def generate_document_status(apps, schema_editor):
Document = apps.get_model("common", "Document")
for document in Document.objects.all():
document.status = "active"
document.save()
class Migration(migrations.Migration):
dependencies = [
("common", "0004_attachments_case"),
]
operations = [
migrations.AlterModelOptions(
name="user",
options={"ordering": ["-is_active"]},
),
migrations.AddField(
model_name="document",
name="status",
field=models.CharField(
choices=[("active", "active"), ("inactive", "inactive")],
default="active",
max_length=64,
),
),
migrations.RunPython(generate_document_status),
]

View file

@ -1,26 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-08 07:09
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0005_auto_20190204_1400"),
]
operations = [
migrations.AddField(
model_name="comment",
name="user",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="user_comments",
to=settings.AUTH_USER_MODEL,
),
),
]

View file

@ -1,48 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-12 08:04
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contacts", "0002_auto_20190212_1334"),
("planner", "0002_auto_20190212_1334"),
("cases", "0003_auto_20190212_1334"),
("opportunity", "0003_auto_20190212_1334"),
("leads", "0004_auto_20190212_1334"),
("accounts", "0005_auto_20190212_1334"),
("common", "0006_comment_user"),
]
operations = [
migrations.RemoveField(
model_name="team",
name="members",
),
migrations.AlterField(
model_name="attachments",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="attachment_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="document",
name="created_by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="document_uploaded",
to=settings.AUTH_USER_MODEL,
),
),
migrations.DeleteModel(
name="Team",
),
]

View file

@ -1,46 +0,0 @@
# Generated by Django 2.1.7 on 2019-02-14 05:51
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0007_auto_20190212_1334"),
]
operations = [
migrations.CreateModel(
name="Google",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("google_id", models.CharField(default="", max_length=200)),
("google_url", models.CharField(default="", max_length=1000)),
("verified_email", models.CharField(default="", max_length=200)),
("family_name", models.CharField(default="", max_length=200)),
("name", models.CharField(default="", max_length=200)),
("gender", models.CharField(default="", max_length=10)),
("dob", models.CharField(default="", max_length=50)),
("given_name", models.CharField(default="", max_length=200)),
("email", models.CharField(db_index=True, default="", max_length=200)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="google",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 2.1.7 on 2019-02-14 06:42
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0008_google"),
]
operations = [
migrations.AddField(
model_name="document",
name="shared_to",
field=models.ManyToManyField(
related_name="document_shared_to", to=settings.AUTH_USER_MODEL
),
),
]

View file

@ -1,54 +0,0 @@
# Generated by Django 2.1.5 on 2019-02-13 13:09
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("accounts", "0006_auto_20190212_1708"),
("common", "0009_document_shared_to"),
]
operations = [
migrations.CreateModel(
name="APISettings",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=1000)),
(
"apikey",
models.CharField(
default="a223998f39691c748515bca13519b7b3", max_length=16
),
),
("created_on", models.DateTimeField(auto_now_add=True)),
(
"created_by",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="settings_created_by",
to=settings.AUTH_USER_MODEL,
),
),
(
"lead_assigned_to",
models.ManyToManyField(
related_name="lead_assignee_users", to=settings.AUTH_USER_MODEL
),
),
("tags", models.ManyToManyField(blank=True, to="accounts.Tags")),
],
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 2.1.7 on 2019-02-18 07:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0010_apisettings"),
]
operations = [
migrations.AlterField(
model_name="apisettings",
name="apikey",
field=models.CharField(blank=True, max_length=16),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 2.1.7 on 2019-02-19 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0011_auto_20190218_1230"),
]
operations = [
migrations.AddField(
model_name="apisettings",
name="website",
field=models.URLField(default="", max_length=255),
),
]

View file

@ -1,37 +0,0 @@
# Generated by Django 2.1.7 on 2019-05-08 10:10
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("tasks", "0002_task_created_by"),
("common", "0012_apisettings_website"),
]
operations = [
migrations.AddField(
model_name="attachments",
name="task",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="tasks_attachment",
to="tasks.Task",
),
),
migrations.AddField(
model_name="comment",
name="task",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="tasks_comments",
to="tasks.Task",
),
),
]

View file

@ -1,37 +0,0 @@
# Generated by Django 2.1.7 on 2019-05-24 05:43
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("invoices", "0002_auto_20190524_1113"),
("common", "0013_auto_20190508_1540"),
]
operations = [
migrations.AddField(
model_name="attachments",
name="invoice",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="invoice_attachment",
to="invoices.Invoice",
),
),
migrations.AddField(
model_name="comment",
name="invoice",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="invoice_comments",
to="invoices.Invoice",
),
),
]

View file

@ -1,37 +0,0 @@
# Generated by Django 2.1.7 on 2019-06-04 13:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("events", "0002_event_date_of_meeting"),
("common", "0014_auto_20190524_1113"),
]
operations = [
migrations.AddField(
model_name="attachments",
name="event",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="events_attachment",
to="events.Event",
),
),
migrations.AddField(
model_name="comment",
name="event",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="events_comments",
to="events.Event",
),
),
]

View file

@ -1,35 +0,0 @@
# Generated by Django 2.2.2 on 2019-06-24 12:46
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0015_auto_20190604_1830"),
]
operations = [
migrations.AddField(
model_name="user",
name="has_marketing_access",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="user",
name="has_sales_access",
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name="comment",
name="lead",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="leads_comments",
to="leads.Lead",
),
),
]

View file

@ -1,47 +0,0 @@
# Generated by Django 2.2.2 on 2019-07-22 09:13
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0016_auto_20190624_1816"),
]
operations = [
migrations.AlterModelOptions(
name="apisettings",
options={"ordering": ("-created_on",)},
),
migrations.AlterModelOptions(
name="document",
options={"ordering": ("-created_on",)},
),
migrations.CreateModel(
name="Profile",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("activation_key", models.CharField(max_length=50)),
("key_expires", models.DateTimeField()),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="profile",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 2.2.4 on 2019-09-17 05:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("teams", "0003_auto_20190909_1621"),
("common", "0017_auto_20190722_1443"),
]
operations = [
migrations.AddField(
model_name="document",
name="teams",
field=models.ManyToManyField(
related_name="document_teams", to="teams.Teams"
),
),
]

View file

@ -1,298 +0,0 @@
# Generated by Django 2.2.10 on 2020-04-01 04:11
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0018_document_teams"),
]
operations = [
migrations.CreateModel(
name="Company",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100)),
("address", models.CharField(max_length=2000)),
("sub_domain", models.CharField(max_length=30)),
("user_limit", models.IntegerField(default=5)),
(
"country",
models.CharField(
blank=True,
choices=[
("GB", "United Kingdom"),
("AF", "Afghanistan"),
("AX", "Aland Islands"),
("AL", "Albania"),
("DZ", "Algeria"),
("AS", "American Samoa"),
("AD", "Andorra"),
("AO", "Angola"),
("AI", "Anguilla"),
("AQ", "Antarctica"),
("AG", "Antigua and Barbuda"),
("AR", "Argentina"),
("AM", "Armenia"),
("AW", "Aruba"),
("AU", "Australia"),
("AT", "Austria"),
("AZ", "Azerbaijan"),
("BS", "Bahamas"),
("BH", "Bahrain"),
("BD", "Bangladesh"),
("BB", "Barbados"),
("BY", "Belarus"),
("BE", "Belgium"),
("BZ", "Belize"),
("BJ", "Benin"),
("BM", "Bermuda"),
("BT", "Bhutan"),
("BO", "Bolivia"),
("BA", "Bosnia and Herzegovina"),
("BW", "Botswana"),
("BV", "Bouvet Island"),
("BR", "Brazil"),
("IO", "British Indian Ocean Territory"),
("BN", "Brunei Darussalam"),
("BG", "Bulgaria"),
("BF", "Burkina Faso"),
("BI", "Burundi"),
("KH", "Cambodia"),
("CM", "Cameroon"),
("CA", "Canada"),
("CV", "Cape Verde"),
("KY", "Cayman Islands"),
("CF", "Central African Republic"),
("TD", "Chad"),
("CL", "Chile"),
("CN", "China"),
("CX", "Christmas Island"),
("CC", "Cocos (Keeling) Islands"),
("CO", "Colombia"),
("KM", "Comoros"),
("CG", "Congo"),
("CD", "Congo, The Democratic Republic of the"),
("CK", "Cook Islands"),
("CR", "Costa Rica"),
("CI", "Cote d'Ivoire"),
("HR", "Croatia"),
("CU", "Cuba"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DK", "Denmark"),
("DJ", "Djibouti"),
("DM", "Dominica"),
("DO", "Dominican Republic"),
("EC", "Ecuador"),
("EG", "Egypt"),
("SV", "El Salvador"),
("GQ", "Equatorial Guinea"),
("ER", "Eritrea"),
("EE", "Estonia"),
("ET", "Ethiopia"),
("FK", "Falkland Islands (Malvinas)"),
("FO", "Faroe Islands"),
("FJ", "Fiji"),
("FI", "Finland"),
("FR", "France"),
("GF", "French Guiana"),
("PF", "French Polynesia"),
("TF", "French Southern Territories"),
("GA", "Gabon"),
("GM", "Gambia"),
("GE", "Georgia"),
("DE", "Germany"),
("GH", "Ghana"),
("GI", "Gibraltar"),
("GR", "Greece"),
("GL", "Greenland"),
("GD", "Grenada"),
("GP", "Guadeloupe"),
("GU", "Guam"),
("GT", "Guatemala"),
("GG", "Guernsey"),
("GN", "Guinea"),
("GW", "Guinea-Bissau"),
("GY", "Guyana"),
("HT", "Haiti"),
("HM", "Heard Island and McDonald Islands"),
("VA", "Holy See (Vatican City State)"),
("HN", "Honduras"),
("HK", "Hong Kong"),
("HU", "Hungary"),
("IS", "Iceland"),
("IN", "India"),
("ID", "Indonesia"),
("IR", "Iran, Islamic Republic of"),
("IQ", "Iraq"),
("IE", "Ireland"),
("IM", "Isle of Man"),
("IL", "Israel"),
("IT", "Italy"),
("JM", "Jamaica"),
("JP", "Japan"),
("JE", "Jersey"),
("JO", "Jordan"),
("KZ", "Kazakhstan"),
("KE", "Kenya"),
("KI", "Kiribati"),
("KP", "Korea, Democratic People's Republic of"),
("KR", "Korea, Republic of"),
("KW", "Kuwait"),
("KG", "Kyrgyzstan"),
("LA", "Lao People's Democratic Republic"),
("LV", "Latvia"),
("LB", "Lebanon"),
("LS", "Lesotho"),
("LR", "Liberia"),
("LY", "Libyan Arab Jamahiriya"),
("LI", "Liechtenstein"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("MO", "Macao"),
("MK", "Macedonia, The Former Yugoslav Republic of"),
("MG", "Madagascar"),
("MW", "Malawi"),
("MY", "Malaysia"),
("MV", "Maldives"),
("ML", "Mali"),
("MT", "Malta"),
("MH", "Marshall Islands"),
("MQ", "Martinique"),
("MR", "Mauritania"),
("MU", "Mauritius"),
("YT", "Mayotte"),
("MX", "Mexico"),
("FM", "Micronesia, Federated States of"),
("MD", "Moldova"),
("MC", "Monaco"),
("MN", "Mongolia"),
("ME", "Montenegro"),
("MS", "Montserrat"),
("MA", "Morocco"),
("MZ", "Mozambique"),
("MM", "Myanmar"),
("NA", "Namibia"),
("NR", "Nauru"),
("NP", "Nepal"),
("NL", "Netherlands"),
("AN", "Netherlands Antilles"),
("NC", "New Caledonia"),
("NZ", "New Zealand"),
("NI", "Nicaragua"),
("NE", "Niger"),
("NG", "Nigeria"),
("NU", "Niue"),
("NF", "Norfolk Island"),
("MP", "Northern Mariana Islands"),
("NO", "Norway"),
("OM", "Oman"),
("PK", "Pakistan"),
("PW", "Palau"),
("PS", "Palestinian Territory, Occupied"),
("PA", "Panama"),
("PG", "Papua New Guinea"),
("PY", "Paraguay"),
("PE", "Peru"),
("PH", "Philippines"),
("PN", "Pitcairn"),
("PL", "Poland"),
("PT", "Portugal"),
("PR", "Puerto Rico"),
("QA", "Qatar"),
("RE", "Reunion"),
("RO", "Romania"),
("RU", "Russian Federation"),
("RW", "Rwanda"),
("BL", "Saint Barthelemy"),
("SH", "Saint Helena"),
("KN", "Saint Kitts and Nevis"),
("LC", "Saint Lucia"),
("MF", "Saint Martin"),
("PM", "Saint Pierre and Miquelon"),
("VC", "Saint Vincent and the Grenadines"),
("WS", "Samoa"),
("SM", "San Marino"),
("ST", "Sao Tome and Principe"),
("SA", "Saudi Arabia"),
("SN", "Senegal"),
("RS", "Serbia"),
("SC", "Seychelles"),
("SL", "Sierra Leone"),
("SG", "Singapore"),
("SK", "Slovakia"),
("SI", "Slovenia"),
("SB", "Solomon Islands"),
("SO", "Somalia"),
("ZA", "South Africa"),
("GS", "South Georgia and the South Sandwich Islands"),
("ES", "Spain"),
("LK", "Sri Lanka"),
("SD", "Sudan"),
("SR", "Suriname"),
("SJ", "Svalbard and Jan Mayen"),
("SZ", "Swaziland"),
("SE", "Sweden"),
("CH", "Switzerland"),
("SY", "Syrian Arab Republic"),
("TW", "Taiwan, Province of China"),
("TJ", "Tajikistan"),
("TZ", "Tanzania, United Republic of"),
("TH", "Thailand"),
("TL", "Timor-Leste"),
("TG", "Togo"),
("TK", "Tokelau"),
("TO", "Tonga"),
("TT", "Trinidad and Tobago"),
("TN", "Tunisia"),
("TR", "Turkey"),
("TM", "Turkmenistan"),
("TC", "Turks and Caicos Islands"),
("TV", "Tuvalu"),
("UG", "Uganda"),
("UA", "Ukraine"),
("AE", "United Arab Emirates"),
("US", "United States"),
("UM", "United States Minor Outlying Islands"),
("UY", "Uruguay"),
("UZ", "Uzbekistan"),
("VU", "Vanuatu"),
("VE", "Venezuela"),
("VN", "Viet Nam"),
("VG", "Virgin Islands, British"),
("VI", "Virgin Islands, U.S."),
("WF", "Wallis and Futuna"),
("EH", "Western Sahara"),
("YE", "Yemen"),
("ZM", "Zambia"),
("ZW", "Zimbabwe"),
],
max_length=3,
null=True,
),
),
],
),
migrations.AddField(
model_name="user",
name="company",
field=models.ForeignKey(
default=1,
on_delete=django.db.models.deletion.CASCADE,
to="common.Company",
),
preserve_default=False,
),
]

View file

@ -1,23 +0,0 @@
# Generated by Django 2.2.10 on 2020-04-09 11:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0019_auto_20200401_0941"),
]
operations = [
migrations.AlterField(
model_name="company",
name="address",
field=models.CharField(blank=True, max_length=2000, null=True),
),
migrations.AlterField(
model_name="company",
name="name",
field=models.CharField(blank=True, max_length=100, null=True),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 2.2.10 on 2020-04-27 11:40
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0020_auto_20200409_1653"),
]
operations = [
migrations.AddField(
model_name="document",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.Company",
),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.0.6 on 2020-06-09 06:33
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0021_document_company"),
]
operations = [
migrations.AlterField(
model_name="user",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="common.Company",
),
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.1 on 2021-01-13 11:24
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0022_auto_20200609_1203"),
]
operations = [
migrations.AddField(
model_name="apisettings",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.company",
),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-23 12:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0023_apisettings_company"),
]
operations = [
migrations.RemoveField(
model_name="user",
name="company",
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-24 07:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0024_remove_user_company"),
]
operations = [
migrations.RemoveField(
model_name="apisettings",
name="company",
),
migrations.RemoveField(
model_name="document",
name="company",
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.1.7 on 2021-03-25 13:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0025_auto_20210324_1307"),
]
operations = [
migrations.AlterField(
model_name="profile",
name="activation_key",
field=models.CharField(max_length=150),
),
]

View file

@ -1,108 +0,0 @@
# Generated by Django 3.2 on 2021-04-18 05:42
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0026_auto_20210325_1923"),
]
operations = [
migrations.AlterField(
model_name="address",
name="address_line",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="Address"
),
),
migrations.AlterField(
model_name="address",
name="city",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="City"
),
),
migrations.AlterField(
model_name="address",
name="postcode",
field=models.CharField(
blank=True, default="", max_length=64, verbose_name="Post/Zip-code"
),
),
migrations.AlterField(
model_name="address",
name="state",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="State"
),
),
migrations.AlterField(
model_name="address",
name="street",
field=models.CharField(
blank=True, default="", max_length=55, verbose_name="Street"
),
),
migrations.AlterField(
model_name="apisettings",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="settings_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="apisettings",
name="title",
field=models.TextField(),
),
migrations.AlterField(
model_name="attachments",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="attachment_created_by",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="company",
name="address",
field=models.TextField(blank=True, default=""),
),
migrations.AlterField(
model_name="company",
name="name",
field=models.CharField(blank=True, default="", max_length=100),
),
migrations.AlterField(
model_name="document",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="document_uploaded",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="document",
name="title",
field=models.TextField(blank=True, default=""),
),
migrations.AlterField(
model_name="google",
name="google_url",
field=models.TextField(default=""),
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 3.2 on 2021-06-18 07:33
import phonenumber_field.modelfields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0027_auto_20210418_1112"),
]
operations = [
migrations.AddField(
model_name="user",
name="phone",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, null=True, region=None
),
),
]

View file

@ -1,68 +0,0 @@
# Generated by Django 3.2.5 on 2021-07-30 07:58
import django.db.models.deletion
import phonenumber_field.modelfields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0028_user_phone"),
]
operations = [
migrations.AddField(
model_name="user",
name="address",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="adress_users",
to="common.address",
),
),
migrations.AddField(
model_name="user",
name="alternate_email",
field=models.EmailField(default="", max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name="user",
name="alternate_phone",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, null=True, region=None
),
),
migrations.AddField(
model_name="user",
name="description",
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name="user",
name="skype_ID",
field=models.CharField(default="", max_length=50),
preserve_default=False,
),
migrations.AddField(
model_name="user",
name="type",
field=models.CharField(default="", max_length=50),
preserve_default=False,
),
migrations.AlterField(
model_name="user",
name="phone",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, null=True, region=None, unique=True
),
),
migrations.AlterField(
model_name="user",
name="role",
field=models.CharField(max_length=50),
),
]

View file

@ -1,20 +0,0 @@
# Generated by Django 3.2.5 on 2021-07-30 08:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0029_auto_20210730_1328"),
]
operations = [
migrations.AlterField(
model_name="user",
name="role",
field=models.CharField(
choices=[("ADMIN", "ADMIN"), ("USER", "USER")], max_length=50
),
),
]

View file

@ -1,125 +0,0 @@
# Generated by Django 3.2.5 on 2021-08-05 06:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0030_alter_user_role"),
]
operations = [
migrations.RenameField(
model_name="user",
old_name="type",
new_name="user_type",
),
migrations.AlterField(
model_name="address",
name="address_line",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="Address"
),
),
migrations.AlterField(
model_name="address",
name="city",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="City"
),
),
migrations.AlterField(
model_name="address",
name="postcode",
field=models.CharField(
blank=True, max_length=64, null=True, verbose_name="Post/Zip-code"
),
),
migrations.AlterField(
model_name="address",
name="state",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="State"
),
),
migrations.AlterField(
model_name="address",
name="street",
field=models.CharField(
blank=True, max_length=55, null=True, verbose_name="Street"
),
),
migrations.AlterField(
model_name="apisettings",
name="website",
field=models.URLField(max_length=255, null=True),
),
migrations.AlterField(
model_name="comment_files",
name="comment_file",
field=models.FileField(
null=True, upload_to="comment_files", verbose_name="File"
),
),
migrations.AlterField(
model_name="company",
name="address",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="company",
name="name",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="document",
name="title",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="google",
name="dob",
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name="google",
name="email",
field=models.CharField(db_index=True, max_length=200, null=True),
),
migrations.AlterField(
model_name="google",
name="family_name",
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name="google",
name="gender",
field=models.CharField(max_length=10, null=True),
),
migrations.AlterField(
model_name="google",
name="given_name",
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name="google",
name="google_id",
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name="google",
name="google_url",
field=models.TextField(null=True),
),
migrations.AlterField(
model_name="google",
name="name",
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name="google",
name="verified_email",
field=models.CharField(max_length=200, null=True),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.2.5 on 2021-08-20 06:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0031_auto_20210805_1214"),
]
operations = [
migrations.RemoveField(
model_name="user",
name="user_type",
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.2.5 on 2021-09-02 06:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0032_remove_user_user_type"),
]
operations = [
migrations.AlterField(
model_name="user",
name="alternate_email",
field=models.EmailField(max_length=255, null=True),
),
]

View file

@ -1,249 +0,0 @@
# Generated by Django 3.2 on 2021-09-13 13:48
import django.db.models.deletion
import phonenumber_field.modelfields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0033_alter_user_alternate_email"),
]
operations = [
migrations.RemoveField(
model_name="comment",
name="user",
),
migrations.RemoveField(
model_name="google",
name="user",
),
migrations.RemoveField(
model_name="user",
name="address",
),
migrations.RemoveField(
model_name="user",
name="alternate_phone",
),
migrations.RemoveField(
model_name="user",
name="has_marketing_access",
),
migrations.RemoveField(
model_name="user",
name="has_sales_access",
),
migrations.RemoveField(
model_name="user",
name="is_admin",
),
migrations.RemoveField(
model_name="user",
name="phone",
),
migrations.RemoveField(
model_name="user",
name="role",
),
migrations.AddField(
model_name="apisettings",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.company",
),
),
migrations.AddField(
model_name="comment",
name="profile",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="user_comments",
to="common.profile",
),
),
migrations.AddField(
model_name="document",
name="company",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="common.company",
),
),
migrations.AddField(
model_name="google",
name="profile",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="google",
to="common.profile",
),
),
migrations.AddField(
model_name="profile",
name="address",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="adress_users",
to="common.address",
),
),
migrations.AddField(
model_name="profile",
name="alternate_phone",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, null=True, region=None
),
),
migrations.AddField(
model_name="profile",
name="company",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="common.company",
),
),
migrations.AddField(
model_name="profile",
name="date_of_joining",
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
model_name="profile",
name="has_marketing_access",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="profile",
name="has_sales_access",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="profile",
name="is_active",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="profile",
name="is_organization_admin",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="profile",
name="phone",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, null=True, region=None, unique=True
),
),
migrations.AddField(
model_name="profile",
name="role",
field=models.CharField(
choices=[("ADMIN", "ADMIN"), ("USER", "USER")],
default="USER",
max_length=50,
),
),
migrations.AlterField(
model_name="apisettings",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="settings_created_by",
to="common.profile",
),
),
migrations.AlterField(
model_name="apisettings",
name="lead_assigned_to",
field=models.ManyToManyField(
related_name="lead_assignee_users", to="common.Profile"
),
),
migrations.AlterField(
model_name="attachments",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="attachment_created_by",
to="common.profile",
),
),
migrations.AlterField(
model_name="comment",
name="commented_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="common.profile",
),
),
migrations.AlterField(
model_name="company",
name="sub_domain",
field=models.CharField(blank=True, max_length=30, null=True),
),
migrations.AlterField(
model_name="document",
name="created_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="document_uploaded",
to="common.profile",
),
),
migrations.AlterField(
model_name="document",
name="shared_to",
field=models.ManyToManyField(
related_name="document_shared_to", to="common.Profile"
),
),
migrations.AlterField(
model_name="profile",
name="activation_key",
field=models.CharField(blank=True, max_length=150, null=True),
),
migrations.AlterField(
model_name="profile",
name="key_expires",
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name="profile",
name="user",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
),
),
migrations.AlterField(
model_name="user",
name="username",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterUniqueTogether(
name="profile",
unique_together={("user", "company")},
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.2 on 2021-09-22 05:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0034_auto_20210913_1918"),
]
operations = [
migrations.RemoveField(
model_name="company",
name="sub_domain",
),
]

View file

@ -1,45 +0,0 @@
# Generated by Django 3.2 on 2021-09-22 12:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("events", "0007_rename_company_event_org"),
("cases", "0009_rename_company_case_org"),
("teams", "0007_rename_company_teams_org"),
("leads", "0016_rename_company_lead_org"),
("contacts", "0009_rename_company_contact_org"),
("invoices", "0011_rename_company_invoice_org"),
("tasks", "0008_rename_company_task_org"),
("accounts", "0014_rename_company_account_org"),
("opportunity", "0008_rename_company_opportunity_org"),
("common", "0035_remove_company_sub_domain"),
]
operations = [
migrations.RenameModel(
old_name="Company",
new_name="Org",
),
migrations.RenameField(
model_name="apisettings",
old_name="company",
new_name="org",
),
migrations.RenameField(
model_name="document",
old_name="company",
new_name="org",
),
migrations.RenameField(
model_name="profile",
old_name="company",
new_name="org",
),
migrations.AlterUniqueTogether(
name="profile",
unique_together={("user", "org")},
),
]

View file

@ -1,24 +0,0 @@
# Generated by Django 3.2.7 on 2021-10-06 07:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0036_auto_20210922_1801"),
]
operations = [
migrations.AlterField(
model_name="profile",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="common.org",
),
),
]

View file

@ -1,74 +0,0 @@
# Generated by Django 3.2.8 on 2022-01-20 07:48
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0037_alter_profile_org"),
]
operations = [
migrations.RemoveField(
model_name="google",
name="profile",
),
migrations.AddField(
model_name="google",
name="user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="google_user",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="google",
name="dob",
field=models.CharField(default="", max_length=50),
),
migrations.AlterField(
model_name="google",
name="email",
field=models.CharField(db_index=True, default="", max_length=200),
),
migrations.AlterField(
model_name="google",
name="family_name",
field=models.CharField(default="", max_length=200),
),
migrations.AlterField(
model_name="google",
name="gender",
field=models.CharField(default="", max_length=10),
),
migrations.AlterField(
model_name="google",
name="given_name",
field=models.CharField(default="", max_length=200),
),
migrations.AlterField(
model_name="google",
name="google_id",
field=models.CharField(default="", max_length=200),
),
migrations.AlterField(
model_name="google",
name="google_url",
field=models.TextField(default=""),
),
migrations.AlterField(
model_name="google",
name="name",
field=models.CharField(default="", max_length=200),
),
migrations.AlterField(
model_name="google",
name="verified_email",
field=models.CharField(default="", max_length=200),
),
]

View file

@ -1,346 +0,0 @@
# Generated by Django 3.2.11 on 2022-02-02 14:53
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0038_auto_20220120_1318"),
]
operations = [
migrations.AlterField(
model_name="address",
name="address_line",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="Address"
),
),
migrations.AlterField(
model_name="address",
name="city",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="City"
),
),
migrations.AlterField(
model_name="address",
name="country",
field=models.CharField(
blank=True,
choices=[
("GB", "United Kingdom"),
("AF", "Afghanistan"),
("AX", "Aland Islands"),
("AL", "Albania"),
("DZ", "Algeria"),
("AS", "American Samoa"),
("AD", "Andorra"),
("AO", "Angola"),
("AI", "Anguilla"),
("AQ", "Antarctica"),
("AG", "Antigua and Barbuda"),
("AR", "Argentina"),
("AM", "Armenia"),
("AW", "Aruba"),
("AU", "Australia"),
("AT", "Austria"),
("AZ", "Azerbaijan"),
("BS", "Bahamas"),
("BH", "Bahrain"),
("BD", "Bangladesh"),
("BB", "Barbados"),
("BY", "Belarus"),
("BE", "Belgium"),
("BZ", "Belize"),
("BJ", "Benin"),
("BM", "Bermuda"),
("BT", "Bhutan"),
("BO", "Bolivia"),
("BA", "Bosnia and Herzegovina"),
("BW", "Botswana"),
("BV", "Bouvet Island"),
("BR", "Brazil"),
("IO", "British Indian Ocean Territory"),
("BN", "Brunei Darussalam"),
("BG", "Bulgaria"),
("BF", "Burkina Faso"),
("BI", "Burundi"),
("KH", "Cambodia"),
("CM", "Cameroon"),
("CA", "Canada"),
("CV", "Cape Verde"),
("KY", "Cayman Islands"),
("CF", "Central African Republic"),
("TD", "Chad"),
("CL", "Chile"),
("CN", "China"),
("CX", "Christmas Island"),
("CC", "Cocos (Keeling) Islands"),
("CO", "Colombia"),
("KM", "Comoros"),
("CG", "Congo"),
("CD", "Congo, The Democratic Republic of the"),
("CK", "Cook Islands"),
("CR", "Costa Rica"),
("CI", "Cote d'Ivoire"),
("HR", "Croatia"),
("CU", "Cuba"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DK", "Denmark"),
("DJ", "Djibouti"),
("DM", "Dominica"),
("DO", "Dominican Republic"),
("EC", "Ecuador"),
("EG", "Egypt"),
("SV", "El Salvador"),
("GQ", "Equatorial Guinea"),
("ER", "Eritrea"),
("EE", "Estonia"),
("ET", "Ethiopia"),
("FK", "Falkland Islands (Malvinas)"),
("FO", "Faroe Islands"),
("FJ", "Fiji"),
("FI", "Finland"),
("FR", "France"),
("GF", "French Guiana"),
("PF", "French Polynesia"),
("TF", "French Southern Territories"),
("GA", "Gabon"),
("GM", "Gambia"),
("GE", "Georgia"),
("DE", "Germany"),
("GH", "Ghana"),
("GI", "Gibraltar"),
("GR", "Greece"),
("GL", "Greenland"),
("GD", "Grenada"),
("GP", "Guadeloupe"),
("GU", "Guam"),
("GT", "Guatemala"),
("GG", "Guernsey"),
("GN", "Guinea"),
("GW", "Guinea-Bissau"),
("GY", "Guyana"),
("HT", "Haiti"),
("HM", "Heard Island and McDonald Islands"),
("VA", "Holy See (Vatican City State)"),
("HN", "Honduras"),
("HK", "Hong Kong"),
("HU", "Hungary"),
("IS", "Iceland"),
("IN", "India"),
("ID", "Indonesia"),
("IR", "Iran, Islamic Republic of"),
("IQ", "Iraq"),
("IE", "Ireland"),
("IM", "Isle of Man"),
("IL", "Israel"),
("IT", "Italy"),
("JM", "Jamaica"),
("JP", "Japan"),
("JE", "Jersey"),
("JO", "Jordan"),
("KZ", "Kazakhstan"),
("KE", "Kenya"),
("KI", "Kiribati"),
("KP", "Korea, Democratic People's Republic of"),
("KR", "Korea, Republic of"),
("KW", "Kuwait"),
("KG", "Kyrgyzstan"),
("LA", "Lao People's Democratic Republic"),
("LV", "Latvia"),
("LB", "Lebanon"),
("LS", "Lesotho"),
("LR", "Liberia"),
("LY", "Libyan Arab Jamahiriya"),
("LI", "Liechtenstein"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("MO", "Macao"),
("MK", "Macedonia, The Former Yugoslav Republic of"),
("MG", "Madagascar"),
("MW", "Malawi"),
("MY", "Malaysia"),
("MV", "Maldives"),
("ML", "Mali"),
("MT", "Malta"),
("MH", "Marshall Islands"),
("MQ", "Martinique"),
("MR", "Mauritania"),
("MU", "Mauritius"),
("YT", "Mayotte"),
("MX", "Mexico"),
("FM", "Micronesia, Federated States of"),
("MD", "Moldova"),
("MC", "Monaco"),
("MN", "Mongolia"),
("ME", "Montenegro"),
("MS", "Montserrat"),
("MA", "Morocco"),
("MZ", "Mozambique"),
("MM", "Myanmar"),
("NA", "Namibia"),
("NR", "Nauru"),
("NP", "Nepal"),
("NL", "Netherlands"),
("AN", "Netherlands Antilles"),
("NC", "New Caledonia"),
("NZ", "New Zealand"),
("NI", "Nicaragua"),
("NE", "Niger"),
("NG", "Nigeria"),
("NU", "Niue"),
("NF", "Norfolk Island"),
("MP", "Northern Mariana Islands"),
("NO", "Norway"),
("OM", "Oman"),
("PK", "Pakistan"),
("PW", "Palau"),
("PS", "Palestinian Territory, Occupied"),
("PA", "Panama"),
("PG", "Papua New Guinea"),
("PY", "Paraguay"),
("PE", "Peru"),
("PH", "Philippines"),
("PN", "Pitcairn"),
("PL", "Poland"),
("PT", "Portugal"),
("PR", "Puerto Rico"),
("QA", "Qatar"),
("RE", "Reunion"),
("RO", "Romania"),
("RU", "Russian Federation"),
("RW", "Rwanda"),
("BL", "Saint Barthelemy"),
("SH", "Saint Helena"),
("KN", "Saint Kitts and Nevis"),
("LC", "Saint Lucia"),
("MF", "Saint Martin"),
("PM", "Saint Pierre and Miquelon"),
("VC", "Saint Vincent and the Grenadines"),
("WS", "Samoa"),
("SM", "San Marino"),
("ST", "Sao Tome and Principe"),
("SA", "Saudi Arabia"),
("SN", "Senegal"),
("RS", "Serbia"),
("SC", "Seychelles"),
("SL", "Sierra Leone"),
("SG", "Singapore"),
("SK", "Slovakia"),
("SI", "Slovenia"),
("SB", "Solomon Islands"),
("SO", "Somalia"),
("ZA", "South Africa"),
("GS", "South Georgia and the South Sandwich Islands"),
("ES", "Spain"),
("LK", "Sri Lanka"),
("SD", "Sudan"),
("SR", "Suriname"),
("SJ", "Svalbard and Jan Mayen"),
("SZ", "Swaziland"),
("SE", "Sweden"),
("CH", "Switzerland"),
("SY", "Syrian Arab Republic"),
("TW", "Taiwan, Province of China"),
("TJ", "Tajikistan"),
("TZ", "Tanzania, United Republic of"),
("TH", "Thailand"),
("TL", "Timor-Leste"),
("TG", "Togo"),
("TK", "Tokelau"),
("TO", "Tonga"),
("TT", "Trinidad and Tobago"),
("TN", "Tunisia"),
("TR", "Turkey"),
("TM", "Turkmenistan"),
("TC", "Turks and Caicos Islands"),
("TV", "Tuvalu"),
("UG", "Uganda"),
("UA", "Ukraine"),
("AE", "United Arab Emirates"),
("US", "United States"),
("UM", "United States Minor Outlying Islands"),
("UY", "Uruguay"),
("UZ", "Uzbekistan"),
("VU", "Vanuatu"),
("VE", "Venezuela"),
("VN", "Viet Nam"),
("VG", "Virgin Islands, British"),
("VI", "Virgin Islands, U.S."),
("WF", "Wallis and Futuna"),
("EH", "Western Sahara"),
("YE", "Yemen"),
("ZM", "Zambia"),
("ZW", "Zimbabwe"),
],
default="",
max_length=3,
),
),
migrations.AlterField(
model_name="address",
name="postcode",
field=models.CharField(
blank=True, default="", max_length=64, verbose_name="Post/Zip-code"
),
),
migrations.AlterField(
model_name="address",
name="state",
field=models.CharField(
blank=True, default="", max_length=255, verbose_name="State"
),
),
migrations.AlterField(
model_name="address",
name="street",
field=models.CharField(
blank=True, default="", max_length=55, verbose_name="Street"
),
),
migrations.AlterField(
model_name="apisettings",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="org_api_settings",
to="common.org",
),
),
migrations.AlterField(
model_name="comment_files",
name="comment_file",
field=models.FileField(
blank=True, null=True, upload_to="comment_files", verbose_name="File"
),
),
migrations.AlterField(
model_name="document",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="document_org",
to="common.org",
),
),
migrations.AlterField(
model_name="profile",
name="org",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="user_org",
to="common.org",
),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.2 on 2022-08-19 10:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0039_auto_20220202_2023"),
]
operations = [
migrations.AddField(
model_name="user",
name="activation_key",
field=models.CharField(blank=True, max_length=150, null=True),
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 4.1 on 2022-09-05 10:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0040_user_activation_key"),
]
operations = [
migrations.AddField(
model_name="user",
name="key_expires",
field=models.DateTimeField(blank=True, null=True),
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 4.1 on 2022-09-05 10:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0041_user_key_expires"),
]
operations = [
migrations.RemoveField(
model_name="profile",
name="activation_key",
),
migrations.RemoveField(
model_name="profile",
name="key_expires",
),
]

50
common/mixins.py Normal file
View file

@ -0,0 +1,50 @@
# Python imports
import uuid
# Django imports
from common.models import models
class TimeAuditModel(models.Model):
"""To path when the record was created and last modified"""
created_at = models.DateTimeField(
auto_now_add=True,
verbose_name="Created At",
)
updated_at = models.DateTimeField(auto_now=True, verbose_name="Last Modified At")
class Meta:
abstract = True
class UserAuditModel(models.Model):
"""To path when the record was created and last modified"""
created_by = models.ForeignKey(
"common.User",
on_delete=models.SET_NULL,
related_name="%(class)s_created_by",
verbose_name="Created By",
null=True,
)
updated_by = models.ForeignKey(
"common.User",
on_delete=models.SET_NULL,
related_name="%(class)s_updated_by",
verbose_name="Last Modified By",
null=True,
)
class Meta:
abstract = True
class AuditModel(TimeAuditModel, UserAuditModel):
"""To path when the record was created and last modified"""
class Meta:
abstract = True

Some files were not shown because too many files have changed in this diff Show more