Coder Social home page Coder Social logo

django-ptrack's People

Contributors

duaneobrien avatar kunjprasad avatar latimer1 avatar mpratt-indeed avatar ramashishb avatar rkyle-indeed avatar rlatimer-indeed avatar russelljk avatar tate-indeed avatar tonyyu-indeed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-ptrack's Issues

Allow empty string settings.PTRACK_APP_URL

I handle url normalization with a post processor. It would be handy if PTRACK_APP_URL could be an empty string.

Not a lot of work but I had to do this:

def rel_ptrack_tag(*args, **kwargs):
    encoded_dict = {'ptrack_encoded_data': ptrack_encoder.encrypt(*args, **kwargs)}
    url = reverse('ptrack', kwargs=encoded_dict)
    return mark_safe("<img src='%s' width=1 height=1>" % (url,))

Django 2 compatibility

Will this library be updated for Django 2? I get the following exception when I try to use:

No module named 'django.core.urlresolvers'

/usr/local/lib/python3.5/dist-packages/ptrack/templatetags/ptrack.py in <module>

    from django.core.urlresolvers import reverse

how to use it with emails?

Hi

Can you add some more information in the readme about how to use it for emails?
If I understand correctly, I can do something like:

from ptrack.templatetags.ptrack import ptrack
img_tag = ptrack(key1='aaa',key2='ccc')

and then I can add the img_tag to the email body.
Is there a different way to do that?

Issue with Python 3

Using ptrack with Python 3 is giving the following error-

nacl.exceptions.TypeError: SecretBox must be created from 32 bytes
On debugging, the issue is with nacl/secret.py > SecretBox

    def __init__(self, key, encoder=encoding.RawEncoder):
        key = encoder.decode(key)
        if not isinstance(key, bytes):
            raise exc.TypeError("SecretBox must be created from 32 bytes")

The check for bytes for decoded key is evaluating to False in Python 3 (it evaluates to True in Python 2).
One way is to convert string to bytes before passing it to SecretBox constructor.
Any other idea?

handle uuid via json encoder

It would be helpful if the default encoder used the DjangoJsonEncoder class for the JSON conversion to automatically handle types like uuid.

This is what happens when you pass a UUID pk through ptrack:

   File "/home/vagrant/.tox/py/lib/python3.7/site-packages/ptrack/templatetags/ptrack.py", line 20, in ptrack
     encoded_dict = {'ptrack_encoded_data': ptrack_encoder.encrypt(*args, **kwargs)}
   File "/home/vagrant/.tox/py/lib/python3.7/site-packages/ptrack/encoder.py", line 46, in encrypt
     data = json.dumps((args, kwargs))
   File "/usr/local/lib/python3.7/json/__init__.py", line 231, in dumps
     return _default_encoder.encode(obj)
   File "/usr/local/lib/python3.7/json/encoder.py", line 199, in encode
     chunks = self.iterencode(o, _one_shot=True)
   File "/usr/local/lib/python3.7/json/encoder.py", line 257, in iterencode
     return _iterencode(o, 0)
   File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
     raise TypeError(f'Object of type {o.__class__.__name__} '
 TypeError: Object of type UUID is not JSON serializable

It would be a small change to this line:

data = json.dumps((args, kwargs))

Python 3 only?

Python 3 is not indicated anywhere in the README. But I see typing being used and get syntax errors in python 2.7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.