Skip to content

Commit

Permalink
new release (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
KingCSharp committed Dec 15, 2021
1 parent 2dfbedf commit 44c898f
Show file tree
Hide file tree
Showing 43 changed files with 1,130 additions and 1,768 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ python manage.py runserver
Then open http://localhost:8000 in your borwser and create a new account with test as company name. We mapped `test.localhost` to `127.0.0.1`. So, it should work properly.


### To edit content

```
python manage.py create_blog_user 'username'
```

The above command will add the user as blog admin to edit content at /blog/admin/

### Useful tools and packages
```
Expand Down
17 changes: 11 additions & 6 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class Tags(models.Model):

def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super(Tags, self).save(*args, **kwargs)
super().save(*args, **kwargs)


class Account(models.Model):

ACCOUNT_STATUS_CHOICE = (("open", "Open"), ("close", "Close"))

name = models.CharField(pgettext_lazy("Name of Account", "Name"), max_length=64)
name = models.CharField(pgettext_lazy(
"Name of Account", "Name"), max_length=64)
email = models.EmailField()
phone = PhoneNumberField(null=True)
industry = models.CharField(
Expand All @@ -38,9 +39,12 @@ class Account(models.Model):
billing_address_line = models.CharField(
_("Address"), max_length=255, blank=True, null=True
)
billing_street = models.CharField(_("Street"), max_length=55, blank=True, null=True)
billing_city = models.CharField(_("City"), max_length=255, blank=True, null=True)
billing_state = models.CharField(_("State"), max_length=255, blank=True, null=True)
billing_street = models.CharField(
_("Street"), max_length=55, blank=True, null=True)
billing_city = models.CharField(
_("City"), max_length=255, blank=True, null=True)
billing_state = models.CharField(
_("State"), max_length=255, blank=True, null=True)
billing_postcode = models.CharField(
_("Post/Zip-code"), max_length=64, blank=True, null=True
)
Expand All @@ -67,7 +71,8 @@ class Account(models.Model):
contacts = models.ManyToManyField(
"contacts.Contact", related_name="account_contacts"
)
assigned_to = models.ManyToManyField(Profile, related_name="account_assigned_users")
assigned_to = models.ManyToManyField(
Profile, related_name="account_assigned_users")
teams = models.ManyToManyField(Teams, related_name="account_teams")
org = models.ForeignKey(
Org, on_delete=models.SET_NULL, null=True, blank=True, related_name="account_org"
Expand Down
7 changes: 3 additions & 4 deletions accounts/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class Meta:

class EmailSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
request_obj = kwargs.pop("request_obj", None)
super(EmailSerializer, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

class Meta:
model = Email
Expand Down Expand Up @@ -95,14 +94,14 @@ class EmailLogSerializer(serializers.ModelSerializer):

class Meta:
model = Email
fields = "email" "contact" "is_sent"
fields = ["email", "contact", "is_sent"]


class AccountCreateSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
account_view = kwargs.pop("account", False)
request_obj = kwargs.pop("request_obj", None)
super(AccountCreateSerializer, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.fields["status"].required = False
if account_view:
self.fields["billing_address_line"].required = True
Expand Down
7 changes: 3 additions & 4 deletions accounts/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from celery import Celery
from django.conf import settings
from django.core.mail import EmailMessage
from django.shortcuts import reverse
from django.template import Context, Template
from django.template.loader import render_to_string

from accounts.models import Account, Email, EmailLog
from common.models import User, Profile
from common.models import Profile
from common.utils import convert_to_custom_timezone

app = Celery("redis://")
Expand Down Expand Up @@ -59,7 +58,7 @@ def send_email(email_obj_id):

@app.task
def send_email_to_assigned_user(
recipients, from_email, domain="demo.django-crm.io", protocol="http"
recipients, from_email
):
""" Send Mail To Users When they are assigned to a contact """
account = Account.objects.filter(id=from_email).first()
Expand All @@ -71,7 +70,7 @@ def send_email_to_assigned_user(
if profile:
recipients_list.append(profile.user.email)
context = {}
context["url"] = protocol + "://" + domain
context["url"] = settings.DOMAIN_NAME
context["user"] = profile.user
context["account"] = account
context["created_by"] = created_by
Expand Down
Loading

0 comments on commit 44c898f

Please sign in to comment.