Skip to main content

Ajax, Extensions and Extras for Grappelli Admin interface

Project description

# grappelli_extras

[![Latest PyPI version](https://pypip.in/v/django-grappelli-extras/badge.png)](https://crate.io/packages/django-grappelli-extras/)

[![Number of PyPI downloads](https://pypip.in/d/django-grappelli-extras/badge.png)](https://crate.io/packages/django-grappelli-extras/)


Available features:

* [Header navbar](#navbar)
Add a dynamic navbar that change according to user permissions

* [Add Links](#add-links)
Add addlink for each model in the nabvar according to user permissions.

* [Traslation](#translation)
Traslation Suport by Locales.

* [Ajax](#ajax)
An Ajax api make queries to django OMR using generics views.

# Using Autocomplete generic view
```javascript
<script>
(function ($) {
var completeEvent = function () {
$(this).autocomplete({
minLength: 2,
source: "{% url 'ajax_autocomplete' %}?app_label=app&model=foo&column_name=name&column_value=code",
select: function (i, o) {
// o contain the object in json format
// you can use it to populate anothers inputs
console.log(o);
}
});
};
$('#complete-input').on('keyup', completeEvent);
})(grp.jQuery)
</script>
```

# Using Autocomplete generic view
```javascript
<script>
(function ($) {
var completeEvent = function () {
$(this).autocomplete({
minLength: 2,
source: "{% url 'ajax_autocomplete' %}?app_label=app&model=foo&column_name=name&column_value=code",
select: function (i, o) {
// o contain the object in json format
// you can use it to populate anothers inputs
console.log(o);
}
});
};
$('#complete-input').on('keyup', completeEvent);
})(grp.jQuery)
</script>
```

* [Integration](#integration)*
Integration of adminactions, filebrowser, import_export modules.

* [Integration](#jquery)
Include a Jquery Plugin to creade modals with objects json getting data from django OMR.

# Requirements

* Python > 2.6
* django-grappelli >= 2.4.5
* Django >= 1.4

# Installation

* ```pip install django-grappelli-extras```

## settings.py

* Put 'grappelli_extras' **before** 'grappelli' on INSTALLED_APPS
* Put 'apptemplates.Loader' on your TEMPLATE_LOADERS setting:

```python
# Your setting will look like:
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
)
```

## urls.py

* Put grappelli extras urls in 'urlpatterns':

```python
# Your urls will look like:
urlpatterns = [
url('admin/', admin.site.urls),
url('grappelli/', include('grappelli.urls')),
url('admin/ajax/', include('grappelli_extras.ajax_urls')),
url('admin/extras/', include('grappelli_extras.extras_urls')),

]
```

* Be sure 'django.core.context_processors.request' on your TEMPLATE_CONTEXT_PROCESSORS setting:


## To run test project

```
cd ~/grappelli_extras/testapp
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```

## Contributing

1. Fork it.
2. Create your feature branch. (`git checkout -b my-new-feature`)
3. Commit your changes. (`git commit -am 'Add some feature'`)
4. Push to the branch. (`git push origin my-new-feature`)
5. Create new Pull Request.

Thank You

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-grappelli-extras-1.0.7.tar.gz (10.0 kB view details)

Uploaded Source

File details

Details for the file django-grappelli-extras-1.0.7.tar.gz.

File metadata

  • Download URL: django-grappelli-extras-1.0.7.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for django-grappelli-extras-1.0.7.tar.gz
Algorithm Hash digest
SHA256 1b195fbc87c3db21bbd1e15d36ae09d71436c44d15a24d67dc64aab1343e45d4
MD5 6bf8caa98f0273dfa88a4cbc0eee0abf
BLAKE2b-256 3165ede4d89304bad64821bebfda22676e956adab7e0b0aa9a45901099880228

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page