GithubHelp home page GithubHelp logo

django-lets-go's Introduction

Django Helper, Utils and mix of Snippets

Django-Lets-go provide a lot of goodies, functions, useful snippets recompiled, if you develop some Django projects you will certainly found something useful here.

Django-lets-go contains the following :

1. Model

  • intermediate_model_base_class

2. Middleware

  • FilterPersistMiddleware

3. Functions

  • get_unique_code - Generate unique code
  • pass_gen - Unique password generator
  • comp_month_range - Prepare month range list to compare with selected month
  • comp_day_range - Prepare day range list to compare with selected day
  • date_range - Get date list between two dates
  • validate_days - Validate no of days in given month and year
  • get_news - Get news from news url
  • only_one - Decorator for distributed task locking in celery
  • ceil_strdate - Convert a string date to either a start or end day date
  • percentage - Get percentage value
  • unset_session_var - Unset settion variable
  • getvar - Check field in POST/GET request and return field value. if there is value you can also save a session variable
  • word_capital - Capitalizes the first character of each word

4. Template tags

  • time_in_min - Convert value in min:sec or seconds format
  • conv_min - Convert value in min:sec format
  • month_name - Get month name from 1-12 int no
  • sort_link - Usage: {% sort_link "link text" "field_name" %} or {% sort_link "link text" "field_name" "Visible name" %}
  • get_fieldset- Make group of fields for field-set

    Usage: {% get_fieldset field1,field2 as list_field from xyz_form %}

  • groupby_rows - Returns a list of n lists. Each sub-list is the same length
  • groupby_rows - Returns a list of lists where each sub-list has n items.
  • listsort - Perform sorting on template list
  • convert_to_int - Convert value to interger
  • wordcap - Capitalizes the first character of each words.
  • percentage_tag - get percentage value.

5. Fields

  • LanguageField - Field to language list

6. Test suite tools

  • build_test_suite_from : Returns a single or group of unittest test suite

7. Admin Class Helper

  • AppLabelRenamer Class for django admin UI
  • export_as_csv_action - Admin custom action which returns an export csv

Installation

  1. Install using the sources :

    pip install -r requirements.txt
    python setup.py install
  2. Install with PIP :

    python install django-lets-go

Projects using Django-lets-go

Changelog

Changelog summary : https://github.com/areski/django-lets-go/blob/master/CHANGELOG.rst

License

Django-lets-go is licensed under MIT

The Initial Developer is Arezqui Belaid <[email protected]>

django-lets-go's People

Contributors

areski avatar jonathan-roper avatar shrenik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-lets-go's Issues

Assumes redis is running on localhost

Hi, I'm deploying CDR-Stats in Docker with Redis in a separate container.
Celery doesn't work as this library assumes there's a redis instance running on the same server.

[2018-08-29 02:13:35,495: INFO/MainProcess] Connected to redis://redis:6379/0
[2018-08-29 02:13:35,509: INFO/MainProcess] mingle: searching for neighbors
[2018-08-29 02:13:36,518: INFO/MainProcess] mingle: all alone
[2018-08-29 02:13:36,535: WARNING/MainProcess] celery@d3c1419f233d ready.
[2018-08-29 02:13:44,853: INFO/MainProcess] Received task: cdr.tasks.run_cdr_import[35b60c4f-f4c7-42fa-b4fa-3f8f82840332]
[2018-08-29 02:13:44,856: DEBUG/MainProcess] Task accepted: cdr.tasks.run_cdr_import[35b60c4f-f4c7-42fa-b4fa-3f8f82840332] pid:748
[2018-08-29 02:13:44,862: ERROR/MainProcess] Task cdr.tasks.run_cdr_import[35b60c4f-f4c7-42fa-b4fa-3f8f82840332] raised unexpected: ConnectionError('Error 99 connecting to localhost:6379.Address not available.',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/django_lets_go/only_one_task.py", line 23, in _caller
    have_lock = lock.acquire(blocking=False)
  File "/usr/local/lib/python2.7/site-packages/redis/lock.py", line 111, in acquire
    if self.do_acquire(token):
  File "/usr/local/lib/python2.7/site-packages/redis/lock.py", line 258, in do_acquire
    client=self.redis))
  File "/usr/local/lib/python2.7/site-packages/redis/client.py", line 2646, in __call__
    return client.evalsha(self.sha, len(keys), *args)
  File "/usr/local/lib/python2.7/site-packages/redis/client.py", line 1911, in evalsha
    return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
  File "/usr/local/lib/python2.7/site-packages/redis/client.py", line 570, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python2.7/site-packages/redis/connection.py", line 556, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python2.7/site-packages/redis/connection.py", line 532, in send_packed_command
    self.connect()
  File "/usr/local/lib/python2.7/site-packages/redis/connection.py", line 436, in connect
    raise ConnectionError(self._error_message(e))
ConnectionError: Error 99 connecting to localhost:6379. Address not available.

Add Python 3 Support

Pip install is failing for python 3.3.3 using django 1.6.1:

(py33_django16)โžœ  $ pip install switch2bill-common
Downloading/unpacking switch2bill-common
  Downloading switch2bill-common-2.8.5.tar.gz
  Running setup.py (path:/.virtualenvs/py33_django16/build/switch2bill-common/setup.py) egg_info for package switch2bill-common

Downloading/unpacking django-reusableapps==0.1.1 (from switch2bill-common)
  Downloading django-reusableapps-0.1.1.tar.gz
  Running setup.py (path:/.virtualenvs/py33_django16/build/django-reusableapps/setup.py) egg_info for package django-reusableapps
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/.virtualenvs/py33_django16/build/django-reusableapps/setup.py", line 2, in <module>
        from ez_setup import use_setuptools
      File "./ez_setup.py", line 97
        except pkg_resources.VersionConflict, e:
                                            ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/.virtualenvs/py33_django16/build/django-reusableapps/setup.py", line 2, in <module>

    from ez_setup import use_setuptools

  File "./ez_setup.py", line 97

    except pkg_resources.VersionConflict, e:

                                        ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /.virtualenvs/py33_django16/build/django-reusableapps
Storing debug log for failure in /.pip/pip.log

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.