Skip to content

Commit 6f85f1f

Browse files
authored
Merge pull request #514 from MicroPyramid/new_release
new release
2 parents 829929d + ba83c76 commit 6f85f1f

15 files changed

+56
-36
lines changed

.runcode.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ onCreate:
1818
python manage.py migrate
1919
onStart:
2020
- |
21-
. ../venv/bin/activate
21+
. ../env/bin/activate
2222
WS_DOMAIN=`cat /home/ubuntu/runcode/ws-url-domain.txt`
2323
printf "\nGO TO THIS URL TO VIEW PAGE \033[4;34m https://8000-${WS_DOMAIN}\033[0;30m\n\n"
2424
python manage.py runserver
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 4.2.1 on 2023-10-13 08:16
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12+
('accounts', '0002_initial'),
13+
]
14+
15+
operations = [
16+
migrations.AlterField(
17+
model_name='account',
18+
name='created_by',
19+
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'),
20+
),
21+
]

accounts/models.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class Account(BaseModel):
6161
)
6262
website = models.URLField(_("Website"), blank=True, null=True)
6363
description = models.TextField(blank=True, null=True)
64-
created_by = models.ForeignKey(
65-
Profile, related_name="account_created_by", on_delete=models.SET_NULL, null=True
66-
)
64+
# created_by = models.ForeignKey(
65+
# Profile, related_name="account_created_by", on_delete=models.SET_NULL, null=True
66+
# )
6767
is_active = models.BooleanField(default=False)
6868
tags = models.ManyToManyField(Tags, blank=True)
6969
status = models.CharField(

accounts/serializer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Meta:
4646
"description",
4747
"account_attachment",
4848
"created_by",
49-
"created_on",
49+
"created_at",
5050
"is_active",
5151
"tags",
5252
"status",
@@ -71,7 +71,7 @@ class Meta:
7171
"timezone",
7272
"scheduled_date_time",
7373
"scheduled_later",
74-
"created_on",
74+
"created_at",
7575
"from_email",
7676
"rendered_message_body",
7777
)
@@ -132,7 +132,7 @@ def __init__(self, *args, **kwargs):
132132
if self.instance:
133133
self.fields["lead"].required = False
134134
self.fields["lead"].required = False
135-
self.org = request_obj.org
135+
self.org = request_obj.profile.org
136136

137137
def validate_name(self, name):
138138
if self.instance:

accounts/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def post(self, request, *args, **kwargs):
140140
# Save Account
141141
if serializer.is_valid():
142142
account_object = serializer.save(
143-
created_by=request.profile, org=request.profile.org
143+
org=request.profile.org
144144
)
145145
if data.get("contacts"):
146146
contacts_list = json.loads(data.get("contacts"))
@@ -171,7 +171,7 @@ def post(self, request, *args, **kwargs):
171171

172172
if self.request.FILES.get("account_attachment"):
173173
attachment = Attachments()
174-
attachment.created_by = request.profile
174+
attachment.created_by = request.profile.user
175175
attachment.file_name = request.FILES.get("account_attachment").name
176176
attachment.account = account_object
177177
attachment.attachment = request.FILES.get("account_attachment")

cases/serializer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Meta:
2626
"closed_on",
2727
"description",
2828
"created_by",
29-
"created_on",
29+
"created_at",
3030
"is_active",
3131
"account",
3232
"contacts",
@@ -43,7 +43,7 @@ class CaseCreateSerializer(serializers.ModelSerializer):
4343
def __init__(self, *args, **kwargs):
4444
request_obj = kwargs.pop("request_obj", None)
4545
super().__init__(*args, **kwargs)
46-
self.org = request_obj.org
46+
self.org = request_obj.profile.org
4747

4848
def validate_name(self, name):
4949
if self.instance:
@@ -67,7 +67,7 @@ class Meta:
6767
"priority",
6868
"description",
6969
"created_by",
70-
"created_on",
70+
"created_at",
7171
"is_active",
7272
"account",
7373
"org",

common/serializer.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class Meta:
184184

185185

186186
class ProfileSerializer(serializers.ModelSerializer):
187+
# address = BillingAddressSerializer()
187188

188189
class Meta:
189190
model = Profile
@@ -210,7 +211,7 @@ def get_file_path(self, obj):
210211

211212
class Meta:
212213
model = Attachments
213-
fields = ["id", "created_by", "file_name", "created_on", "file_path"]
214+
fields = ["id", "created_by", "file_name", "created_at", "file_path"]
214215

215216

216217
class DocumentSerializer(serializers.ModelSerializer):
@@ -231,7 +232,7 @@ class Meta:
231232
"status",
232233
"shared_to",
233234
"teams",
234-
"created_on",
235+
"created_at",
235236
"created_by",
236237
"org",
237238
]
@@ -242,7 +243,7 @@ def __init__(self, *args, **kwargs):
242243
request_obj = kwargs.pop("request_obj", None)
243244
super().__init__(*args, **kwargs)
244245
self.fields["title"].required = True
245-
self.org = request_obj.org
246+
self.org = request_obj.profile.org
246247

247248
def validate_title(self, title):
248249
if self.instance:
@@ -312,7 +313,7 @@ class Meta:
312313
"title",
313314
"apikey",
314315
"website",
315-
"created_on",
316+
"created_at",
316317
"created_by",
317318
"lead_assigned_to",
318319
"tags",

common/views.py

-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ class ProfileView(APIView):
434434
def get(self, request, format=None):
435435
# profile=Profile.objects.get(user=request.user)
436436
context = {}
437-
print("I am here")
438-
print(self.request.profile)
439437
context["user_obj"] = ProfileSerializer(self.request.profile).data
440438
return Response(context, status=status.HTTP_200_OK)
441439

contacts/serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Meta:
5151
"contact_attachment",
5252
"assigned_to",
5353
"created_by",
54-
"created_on",
54+
"created_at",
5555
"is_active",
5656
"teams",
5757
"created_on_arrow",

contacts/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def post(self, request, *args, **kwargs):
128128

129129
if request.FILES.get("contact_attachment"):
130130
attachment = Attachments()
131-
attachment.created_by = request.profile
131+
attachment.created_by = request.profile.user
132132
attachment.file_name = request.FILES.get("contact_attachment").name
133133
attachment.contact = contact_obj
134134
attachment.attachment = request.FILES.get("contact_attachment")
@@ -227,7 +227,7 @@ def put(self, request, pk, format=None):
227227
)
228228
if request.FILES.get("contact_attachment"):
229229
attachment = Attachments()
230-
attachment.created_by = request.profile
230+
attachment.created_by = request.profile.user
231231
attachment.file_name = request.FILES.get("contact_attachment").name
232232
attachment.contact = contact_obj
233233
attachment.attachment = request.FILES.get("contact_attachment")

events/serializer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Meta:
3838
"description",
3939
"date_of_meeting",
4040
"created_by",
41-
"created_on",
41+
"created_at",
4242
"contacts",
4343
"teams",
4444
"assigned_to",
@@ -53,7 +53,7 @@ def __init__(self, *args, **kwargs):
5353
request_obj = kwargs.pop("request_obj", None)
5454
super(EventCreateSerializer, self).__init__(*args, **kwargs)
5555
self.fields["event_type"].required = True
56-
self.org = request_obj.org
56+
self.org = request_obj.profile.org
5757

5858
def validate_name(self, name):
5959
if self.instance:
@@ -126,7 +126,7 @@ class Meta:
126126
"disabled",
127127
"description",
128128
"created_by",
129-
"created_on",
129+
"created_at",
130130
"org",
131131
)
132132

invoices/serializer.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Meta:
3030
"phone",
3131
"from_address",
3232
"to_address",
33-
"created_on",
33+
"created_at",
3434
"created_by",
3535
"currency",
3636
"quantity",
@@ -61,7 +61,7 @@ class Meta:
6161
"name",
6262
"email",
6363
"phone",
64-
"created_on",
64+
"created_at",
6565
"currency",
6666
"quantity",
6767
"rate",
@@ -80,7 +80,7 @@ def __init__(self, *args, **kwargs):
8080
request_obj = kwargs.pop("request_obj", None)
8181
super(InvoiceCreateSerializer, self).__init__(*args, **kwargs)
8282

83-
self.org = request_obj.org
83+
self.org = request_obj.profile.org
8484

8585
def validate_invoice_title(self, invoice_title):
8686
if self.instance:
@@ -113,7 +113,7 @@ class Meta:
113113
"email",
114114
"phone",
115115
"due_date",
116-
"created_on",
116+
"created_at",
117117
"created_by",
118118
"currency",
119119
"quantity",

opportunity/serializer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Meta:
4141
"description",
4242
"assigned_to",
4343
"created_by",
44-
"created_on",
44+
"created_at",
4545
"is_active",
4646
"tags",
4747
"opportunity_attachment",
@@ -61,7 +61,7 @@ class OpportunityCreateSerializer(serializers.ModelSerializer):
6161
def __init__(self, *args, **kwargs):
6262
request_obj = kwargs.pop("request_obj", None)
6363
super().__init__(*args, **kwargs)
64-
self.org = request_obj.org
64+
self.org = request_obj.profile.org
6565

6666
def validate_name(self, name):
6767
if self.instance:
@@ -94,7 +94,7 @@ class Meta:
9494
"closed_on",
9595
"description",
9696
"created_by",
97-
"created_on",
97+
"created_at",
9898
"is_active",
9999
"created_on_arrow",
100100
"org"

tasks/serializer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Meta:
2828
"due_date",
2929
"account",
3030
"created_by",
31-
"created_on",
31+
"created_at",
3232
"contacts",
3333
"teams",
3434
"assigned_to",
@@ -41,7 +41,7 @@ class TaskCreateSerializer(serializers.ModelSerializer):
4141
def __init__(self, *args, **kwargs):
4242
request_obj = kwargs.pop("request_obj", None)
4343
super().__init__(*args, **kwargs)
44-
self.org = request_obj.org
44+
self.org = request_obj.profile.org
4545

4646
self.fields["title"].required = True
4747

@@ -68,7 +68,7 @@ class Meta:
6868
"due_date",
6969
"account",
7070
"created_by",
71-
"created_on",
71+
"created_at",
7272
)
7373

7474
class TaskDetailEditSwaggerSerializer(serializers.Serializer):

teams/serializer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Meta:
1515
"name",
1616
"description",
1717
"users",
18-
"created_on",
18+
"created_at",
1919
"created_by",
2020
"created_on_arrow",
2121
)
@@ -49,7 +49,7 @@ class Meta:
4949
fields = (
5050
"name",
5151
"description",
52-
"created_on",
52+
"created_at",
5353
"created_by",
5454
"created_on_arrow",
5555
"org",

0 commit comments

Comments
 (0)