Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Major update #12

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
70de5f6
Update urls.py
mykljohn Aug 25, 2017
4e21324
Update views.py
mykljohn Aug 25, 2017
7439090
Update admin.py
mykljohn Aug 25, 2017
c04620a
Update widgets.py
mykljohn Aug 25, 2017
6617b53
Update views.py
mykljohn Aug 25, 2017
2b8c330
Remove deprecated `get_model` function, replaced by `oscar` custom fu…
SalahAdDin Sep 3, 2017
41064c1
Remove deprecated missing `get_model`.
SalahAdDin Sep 3, 2017
d088ab6
Merge pull request #1 from SalahAdDin/master
mykljohn Sep 3, 2017
0036e23
Remove instances of {% load url from future %}
SalahAdDin Sep 3, 2017
c9e96e8
Remove unnused urls file and update documentation
SalahAdDin Sep 3, 2017
4c2613f
Removed useless `/`
SalahAdDin Sep 3, 2017
0884035
Removed unrequired dependencies.
SalahAdDin Sep 3, 2017
b32e89d
Update app views and urls.
SalahAdDin Sep 3, 2017
f0a45f9
Update dashboard apps: firs steps.
SalahAdDin Sep 3, 2017
4f66e99
Update string text with python2 compatibilities.
SalahAdDin Sep 3, 2017
23fc130
Update views in new `Oscar` style.
SalahAdDin Sep 3, 2017
335385b
Merge pull request #2 from SalahAdDin/master
mykljohn Sep 3, 2017
2369f34
Update dashboard forms and views.
SalahAdDin Sep 16, 2017
d379e80
Update templates for views:
SalahAdDin Sep 16, 2017
009c27c
Updated buttons in templates.
SalahAdDin Sep 16, 2017
38000ff
Added missing strings.
SalahAdDin Sep 16, 2017
5239a65
Update dashboard setup.
SalahAdDin Sep 16, 2017
71cd5dc
Update templates
SalahAdDin Sep 18, 2017
4b69239
Merge pull request #3 from SalahAdDin/master
mykljohn Sep 19, 2017
4c72e11
Refactored migrations
SalahAdDin Sep 24, 2017
377cffa
Refactored templates:
SalahAdDin Sep 24, 2017
42a2eab
Cleaning
SalahAdDin Sep 24, 2017
cdca1f1
Refactoring API: beginning
SalahAdDin Sep 24, 2017
5599f34
Improve update ticket view:
SalahAdDin Sep 25, 2017
f2c37cd
Refactored action buttons:
SalahAdDin Sep 25, 2017
13c3656
Improved Ticker serializer
SalahAdDin Sep 25, 2017
39c4d23
Beginning to implements formsets: Attachment
SalahAdDin Sep 26, 2017
6ca8d0d
Trying to implement Attachment inline formset
SalahAdDin Sep 29, 2017
5b11d04
Trying to make it works: Attachment formset
SalahAdDin Oct 2, 2017
08dcad6
Implemented formsets for Ticket Updated View in Dashboard
SalahAdDin Oct 5, 2017
a542c9e
FInalized formsets features
SalahAdDin Oct 5, 2017
cbe67ae
Merge branch 'formsets'
SalahAdDin Oct 5, 2017
c94c74c
Updating setup
SalahAdDin Oct 5, 2017
b1af881
Added missing forms.
SalahAdDin Oct 5, 2017
2f7e819
Added useful fields for update views.
SalahAdDin Oct 5, 2017
8f82525
Improved all views:
SalahAdDin Oct 9, 2017
6f01f7e
Fixed missing lines.
SalahAdDin Oct 10, 2017
0dfa32d
Improve API: AddTicketView
SalahAdDin Oct 10, 2017
fdbcae9
Merge pull request #4 from SalahAdDin/master
mykljohn Oct 11, 2017
7622140
Update requirements.txt
mykljohn Oct 14, 2017
b550cba
Update requirements.txt
mykljohn Oct 14, 2017
4af9c92
Remove problematic and useless code.
SalahAdDin Nov 21, 2017
7aa857a
Replaced Tag UpdateView with FormsetViews.
SalahAdDin Feb 9, 2018
2f33ff9
Refactored templates for new views.
SalahAdDin Feb 9, 2018
c4f9a25
Added missed URL.
SalahAdDin Feb 9, 2018
4fbc9d7
Refactored template.
SalahAdDin Feb 9, 2018
6b9fc2d
Improved admin panel.
SalahAdDin Feb 9, 2018
deba472
Fix search fields in admin.
SalahAdDin Feb 10, 2018
c196552
Added a humble changelog.
SalahAdDin Feb 10, 2018
4accc6e
Merge pull request #1 from mykljohn/master
SalahAdDin Feb 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 1.0.0
files = setup.py oscar_support/__init__.py docs/source/conf.py
commit = True
tag = True
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ python:
- "2.6"
- "2.7"
env:
- DJANGO_VERSION=">=1.4,<1.5" OSCAR_VERSION=">=0.6,<0.7"
- DJANGO_VERSION=">=1.5,<1.6" OSCAR_VERSION=">=0.6,<0.7"
- DJANGO_VERSION=">=1.8,<2.0" OSCAR_VERSION=">=1.3,<1.6"
- DJANGO_VERSION=">=1.8,<2.0" OSCAR_VERSION=">=1.3,<1.6"
install:
- pip install Django$DJANGO_VERSION django-oscar$OSCAR_VERSION
- pip install .
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__CHANGELOG:__

__1.0.0__

- Support for insert files, orders, lines and products in `dashboard` and `admin`.
- Add ticket types, ticket statuses and priorities in `dashboard`.
- Create, Edit and Delete tickets.
9 changes: 7 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Currently it only allow very basic functionality such as:
#. Reply to a customer with a message.
#. Make a note on the ticket for internal use.
#. Assign tickets to a staff user.
#. Relating a ticket to products, orders or order lines(User case: only staff can do it, staff take al information from attached files (invoices for example))
#. Allow file attachments

Features currently in the making:

#. Relating a ticket to products, orders or order lines
#. Allow file attachments
#. Integrate with Oscar's alert system to notify the user of new replies.
#. Add templating for messages in the dashboard for quicker replies.

Expand All @@ -44,6 +44,11 @@ Longer-term direction:
are then prioritized or re-assigned according to actions related to these
SLAs.

For to do:

* Test and coverage for all features.
* Improve styles: print only file name instead his path.
* Not all changes in the forms have to make a new messages.

Screenshots
-----------
Expand Down
31 changes: 12 additions & 19 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
Getting Started
===============

.. warning:: *django-oscar-support* has been tested with Oscar 0.6 ``master``
(due to it's pre-release state) and only works with commit `4aea545de3`_
or later. Due to major changes in the stock record architecture and the
customer account templates earlier version will not work with the
instructions below.

.. _`4aea545de3`: https://github.com/tangentlabs/django-oscar/commit/4aea545de3d79fb20af49c24984541873c6be89c

Installation
Expand All @@ -24,7 +18,7 @@ Start off by installing the required package either from PyPI::

or install the latest version from github using::

pip install git+https://github.com/tangentlabs/django-oscar-support.git
pip install git+https://github.com/mykljohn/django-oscar-support.git

To make your Django project aware of the new package add it to your
``INSTALLED_APPS``::
Expand Down Expand Up @@ -57,14 +51,18 @@ a default UI for these two entry points but they need to be hooked into your
Oscar project. Let's start by adding the URL patterns to your current project
by adding the following line into your ``urls.py`` file::

import oscar_support.urls

urlpatterns = patterns(''
from oscar_support.app import application as support
from oscar_support.api.app import application as support_api
from oscar_support.dashboard.app import application as support_dashboard

urlpatterns = [
...
url(r'^dashboard/support/', include(support_dashboard.urls)),
url(r'^', include(shop.urls)), # Oscar's URL patterns
url(r'^', include(oscar_support.urls)),
url(r'', include(support.urls)),
url(r'^api/', include(support_api.urls)), # You can use instead Oscar api urls
...
)
]

This will provide all the URLs required to interact with the support system.
The next step is to make the dashboard UI available in the navigation using
Expand All @@ -75,18 +73,14 @@ Oscar's ``OSCAR_DASHBOARD_NAVIGATION`` settings::

....

OSCAR_DASHBOARD_NAVIGATION = OSCAR_DASHBOARD_NAVIGATION + [
OSCAR_DASHBOARD_NAVIGATION += [
{
'label': _("Support"),
'icon': 'icon-comments',
'url_name': 'support-dashboard:ticket-list',
}
]

.. note:: Make sure that you aren't using ``OSCAR_DASHBOARD_NAVIGATION +=``
because this will cause duplicate entries due to a bug in Django that will
only be fixed in version 1.6+

All that is left to do now is integrating the customer-facing part of the
support system. The templates that come with *django-oscar-support* extend
Oscar's customer account templates and should pick up the styles that are
Expand All @@ -102,11 +96,10 @@ template directory and add the following content::

{% extends "oscar/customer/baseaccountpage.html" %}
{% load i18n %}
{% load url from future %}

{% block standard_tabs %}
{{ block.super }}
<li>
<li{% if active_tab == 'support' %} class="active"{% endif %}>
<a href="{% url 'support:customer-ticket-list' %}">{% trans "Support" %}</a>
</li>
{% endblock %}
Expand Down
3 changes: 2 additions & 1 deletion oscar_support/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = '0.1.0'
__version__ = '0.2.0'
default_app_config = 'oscar_support.config.OscarSupportConfig'
61 changes: 45 additions & 16 deletions oscar_support/abstract_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from shortuuidfield import ShortUUIDField
Expand All @@ -17,11 +19,12 @@ class Meta:
abstract = True


@python_2_unicode_compatible
class AbstractTicketType(BaseSupportModel):
slug = AutoSlugField(_("Slug"), populate_from='name', unique=True)
name = models.CharField(_("Name"), max_length=64)

def __unicode__(self):
def __str__(self):
return self.name

class Meta:
Expand All @@ -30,11 +33,12 @@ class Meta:
verbose_name_plural = _("Ticket types")


@python_2_unicode_compatible
class AbstractTicketStatus(BaseSupportModel):
slug = AutoSlugField(_("Slug"), populate_from='name', unique=True)
name = models.CharField(_("Name"), max_length=64)

def __unicode__(self):
def __str__(self):
return self.name

class Meta:
Expand All @@ -43,6 +47,7 @@ class Meta:
verbose_name_plural = _("Ticket statuses")


@python_2_unicode_compatible
class AbstractTicket(ModificationTrackingMixin, BaseSupportModel):
number = models.CharField(
_("Number"),
Expand Down Expand Up @@ -93,7 +98,9 @@ class AbstractTicket(ModificationTrackingMixin, BaseSupportModel):

# main content of the (initial) ticket
subject = models.CharField(_("Subject"), max_length=255)
body = models.TextField(_("Body"))
body = models.TextField(_("Body"), blank=True)
# TODO: In CreateForm in dashboard JS give us: An invalid form control with name='body' is not focusable,
# for avoid it was needed make BODY unrequired, putting "black=true" property. It doesn't happen in customer view.

priority = models.ForeignKey(
'Priority',
Expand Down Expand Up @@ -145,8 +152,15 @@ def save(self, *args, **kwargs):
self.subticket_id = ticket_numbers['subticket_id']
return super(AbstractTicket, self).save(*args, **kwargs)

def __unicode__(self):
return "Ticket #{0}".format(self.printable_number)
def __str__(self):
return _("Ticket #{0}").format(self.printable_number)

def get_absolute_url(self):
"""
Return a product's absolute url
"""
return reverse('support:customer-ticket-update',
kwargs={'pk': self.uuid})

class Meta:
abstract = True
Expand All @@ -158,17 +172,22 @@ class Meta:
unique_together = (('number', 'subticket_id'),)


@python_2_unicode_compatible
class AbstractPriority(BaseSupportModel):
name = models.CharField(_("Name"), max_length=255)
slug = AutoSlugField(_("Slug"), populate_from='name')
comment = models.TextField(_("Comment"), blank=True)

def __str__(self):
return self.name

class Meta:
abstract = True
verbose_name = _("Priority")
verbose_name_plural = _("Priorities")


@python_2_unicode_compatible
class AbstractMessage(ModificationTrackingMixin, BaseSupportModel):
PUBLIC = u'public'
INTERNAL = u'internal'
Expand Down Expand Up @@ -198,8 +217,8 @@ class AbstractMessage(ModificationTrackingMixin, BaseSupportModel):
def is_internal(self):
return self.type == self.INTERNAL

def __unicode__(self):
return "{0} from {1} for ticket #{2}".format(
def __str__(self):
return _("{0} from {1} for {2}").format(
self.type,
self.user.email,
self.ticket
Expand All @@ -212,6 +231,7 @@ class Meta:
verbose_name_plural = _("Messages")


@python_2_unicode_compatible
class AbstractRelatedItem(ModificationTrackingMixin, BaseSupportModel):
ticket = models.ForeignKey(
'Ticket',
Expand All @@ -224,58 +244,65 @@ class AbstractRelatedItem(ModificationTrackingMixin, BaseSupportModel):
related_name="%(class)ss",
)

def __str__(self):
return _("{0} related to {1}").format(self.ticket, self.user)

class Meta:
abstract = True


@python_2_unicode_compatible
class AbstractRelatedOrderLine(AbstractRelatedItem):
line = models.ForeignKey(
"order.Line",
verbose_name=_("Order line"),
related_name="ticket_related_order_lines",
)

def __unicode__(self):
return "{0} related to {1}".format(self.line, self.ticket)
def __str__(self):
return _("{0} related to {1}").format(self.line, self.ticket)

class Meta:
abstract = True
verbose_name = _("Related order line")
verbose_name_plural = _("Related order lines")


@python_2_unicode_compatible
class AbstractRelatedOrder(AbstractRelatedItem):
order = models.ForeignKey(
"order.Order",
verbose_name=_("Order"),
related_name="ticket_related_orders",
)

def __unicode__(self):
return "{0} related to {1}".format(self.order, self.ticket)
def __str__(self):
return _("{0} related to {1}").format(self.order, self.ticket)

class Meta:
abstract = True
verbose_name = _("Related order")
verbose_name_plural = _("Related orders")


@python_2_unicode_compatible
class AbstractRelatedProduct(AbstractRelatedItem):
product = models.ForeignKey(
"catalogue.Product",
verbose_name=_("Product"),
related_name="ticket_related_products",
)

def __unicode__(self):
return "{0} related to {1}".format(self.product, self.ticket)
def __str__(self):
return _("{0} related to {1}").format(self.product, self.ticket)

class Meta:
abstract = True
verbose_name = _("Related product")
verbose_name_plural = _("Related products")


@python_2_unicode_compatible
class AbstractAttachment(ModificationTrackingMixin, BaseSupportModel):
ticket = models.ForeignKey(
'Ticket',
Expand All @@ -289,11 +316,13 @@ class AbstractAttachment(ModificationTrackingMixin, BaseSupportModel):
)
file = models.FileField(
upload_to="oscar_support/%Y/%m",
verbose_name=_("File")
verbose_name=_("File"),
help_text=_("Add documents that present important information to understand the problem, "
"such as: invoices, catalogs, photos, orders, etc.")
)

def __unicode__(self):
return "{0} attached to {1}".format(self.file.url, self.ticket)
def __str__(self):
return _("{0} attached to {1}").format(self.file.url, self.ticket)

class Meta:
abstract = True
Expand Down
Loading