Commit e73af81c authored by Yohan Boniface's avatar Yohan Boniface

Use a more conventional name (was django-chickpea)

parent 46f7e7db
[submodule "chickpea/static/leaflet"]
path = chickpea/static/leaflet
[submodule "leaflet_storage/static/leaflet"]
path = leaflet_storage/static/leaflet
url = git://github.com/CloudMade/Leaflet.git
[submodule "chickpea/static/draw"]
path = chickpea/static/draw
[submodule "leaflet_storage/static/draw"]
path = leaflet_storage/static/draw
url = git://github.com/jacobtoye/Leaflet.draw.git
[submodule "chickpea/static/hash"]
path = chickpea/static/hash
[submodule "leaflet_storage/static/hash"]
path = leaflet_storage/static/hash
url = git://github.com/mlevans/leaflet-hash.git
[submodule "chickpea/static/storage"]
path = chickpea/static/storage
[submodule "leaflet_storage/static/storage"]
path = leaflet_storage/static/storage
url = git://github.com/yohanboniface/Leaflet.Storage.git
include README.rst
recursive-include chickpea/static *
recursive-include chickpea/templates *
\ No newline at end of file
recursive-include leaflet_storage/static *
recursive-include leaflet_storage/templates *
\ No newline at end of file
===============
Django-Chickpea
===============
======================
Django-Leaflet-Storage
======================
Provide collaborative maps for your Django project.
Built on top of `Geodjango <http://geodjango.org/>`_ and `Leaflet <http://leaflet.cloudmade.com/>`_.
Django-Leaflet-Storage is a backend for `Leaflet.Storage <https://github.com/yohanboniface/Leaflet.Storage>`_, built on top of `Geodjango <http://geodjango.org/>`_ and `Leaflet <http://leaflet.cloudmade.com/>`_.
It's in "molto alpha" stage, but already usable for proof-of-concept projects. Demo `here <http://youmap.fluv.io>`_
Goals:
......@@ -39,18 +41,18 @@ Installation
Then you can pip install the rep, only from its repo for now::
pip install git+git://github.com/yohanboniface/django-chickpea.git
pip install git+git://github.com/yohanboniface/django-leaflet-storage.git
Add `chickpea` to you apps::
Add `leaflet_storage` to you apps::
INSTALLED_APPS = (
...
"chickpea",
"leaflet_storage",
)
Include `chickpea` urls::
Include `leaflet_storage` urls::
(r'', include('chickpea.urls')),
(r'', include('leaflet_storage.urls')),
Create tables::
......@@ -77,11 +79,11 @@ Advanced configuration
Use your own models
-------------------
Sometimes, you will need to add specific properties to the Marker, Polyline or Polygon. Its easy to do so with `chickpea`.
Sometimes, you will need to add specific properties to the Marker, Polyline or Polygon. Its easy to do so with `leaflet_storage`.
Create a model that inherit from `AbstractMarker` (for Marker example)::
from chickpea.base_models import AbstractMarker
from leaflet_storage.base_models import AbstractMarker
class MyMarker(AbstractMarker):
......@@ -89,7 +91,7 @@ Create a model that inherit from `AbstractMarker` (for Marker example)::
Then, in your settings, add::
CHICKPEA_MODELS = {
LEAFLET_STORAGE_MODELS = {
"Marker": ('my_app', 'MyModel'),
}
......@@ -100,7 +102,7 @@ Then, in your settings, add::
Decide which features are editable
----------------------------------
For now, only Marker, Polyline and Poygon features are supported.
For now, only Marker, Polyline and Polygon features are supported.
Maybe you just want for example the Marker to be editable.
For this, you will need to override the map configuration in JavaScript.
You will have to explicity prevent the Polyline and Polygon editing,
......
......@@ -3,5 +3,5 @@ VERSION = (0, 0, 8)
__author__ = 'Yohan Boniface'
__contact__ = "yb@enix.fr"
__homepage__ = "https://github.com/yohanboniface/django-chickpea"
__homepage__ = "https://github.com/yohanboniface/django-leaflet-storage"
__version__ = ".".join(map(str, VERSION))
from django.contrib.gis import admin
from chickpea.models import Map, Marker, Category, Pictogram, TileLayer, Polyline,\
Licence
from .models import Map, Marker, Category, Pictogram, TileLayer, Polyline,\
Licence
class MapToTileLayerAdmin(admin.TabularInline):
......
......@@ -229,13 +229,13 @@ class Polygon(AbstractPolygon):
def get_model(name):
"""
Example of settings:
CHICKPEA_MODELS = {
LEAFLET_STORAGE_MODELS = {
"Marker": ('app_name', 'ModelName'),
}
"""
CHICKPEA_MODELS = getattr(settings, "CHICKPEA_MODELS", {})
if not name in CHICKPEA_MODELS:
LEAFLET_STORAGE_MODELS = getattr(settings, "LEAFLET_STORAGE_MODELS", {})
if not name in LEAFLET_STORAGE_MODELS:
model = globals()[name]
else:
model = dj_get_model(*CHICKPEA_MODELS[name])
model = dj_get_model(*LEAFLET_STORAGE_MODELS[name])
return model
......@@ -4,7 +4,7 @@ from django.contrib.gis.geos import Point
from vectorformats.Formats import GeoJSON
from chickpea.models import Map, Category
from .models import Map, Category
class PlaceholderForm(forms.ModelForm):
......
# -*- coding: utf-8 -*-
from chickpea.base_models import (Category, Map, TileLayer, Pictogram, Licence,
from .base_models import (Category, Map, TileLayer, Pictogram, Licence,
MapToTileLayer, get_model)
# Marker is the only model configurable for now
......
File moved
File moved
File moved
File moved
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% block title %}Chickpea Map{% endblock %}</title>
<title>{% block title %}Leaflet Storage Map{% endblock %}</title>
{% block extra_head %}
{% endblock %}
</head>
......
{% extends "base.html" %}
{% load chickpea_tags %}
{% load leaflet_storage_tags %}
{% block title %}{{ map.name }}{% endblock %}
{% block body_class %}map_detail{% endblock %}
{% block extra_head %}
{{ block.super }}
{% chickpea_css %}
{% chickpea_js %}
{% leaflet_storage_css %}
{% leaflet_storage_js %}
{% endblock %}
{% block content %}
{% block map_init %}
{% include "chickpea/map_init.html" %}
{% include "leaflet_storage/map_init.html" %}
{% endblock %}
{% endblock %}
\ No newline at end of file
......@@ -2,27 +2,27 @@ from django.utils import simplejson
from django import template
from django.conf import settings
from chickpea.models import Category
from chickpea.views import _urls_for_js
from ..models import Category
from ..views import _urls_for_js
register = template.Library()
@register.inclusion_tag('chickpea/css.html')
def chickpea_css():
@register.inclusion_tag('leaflet_storage/css.html')
def leaflet_storage_css():
return {
"STATIC_URL": settings.STATIC_URL
}
@register.inclusion_tag('chickpea/js.html')
def chickpea_js():
@register.inclusion_tag('leaflet_storage/js.html')
def leaflet_storage_js():
return {
"STATIC_URL": settings.STATIC_URL
}
@register.inclusion_tag('chickpea/map_fragment.html')
@register.inclusion_tag('leaflet_storage/map_fragment.html')
def map_fragment(map_instance):
tilelayer_data = {
'tilelayer': map_instance.tilelayers.all()[0].json,
......
......@@ -6,7 +6,7 @@ from django.core.urlresolvers import reverse
import factory
from chickpea.models import Map, TileLayer, Licence, Category, Marker
from leaflet_storage.models import Map, TileLayer, Licence, Category, Marker
class LicenceFactory(factory.Factory):
......
......@@ -5,7 +5,7 @@ from django.utils import simplejson
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from chickpea.models import Map, Category, Marker, Polygon, Polyline
from leaflet_storage.models import Map, Category, Marker, Polygon, Polyline
from .base import (MapFactory, CategoryFactory, MarkerFactory,
UserFactory, BaseTest)
......
......@@ -2,7 +2,7 @@ from django.conf.urls import patterns, url
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.views import login
from chickpea import views
from . import views
from .decorators import login_required, jsonize_view, map_permissions_check
from .utils import decorated_patterns
......
......@@ -94,7 +94,7 @@ class MapView(DetailView):
class MapInfos(DetailView):
model = Map
template_name = "chickpea/map_infos.html"
template_name = "leaflet_storage/map_infos.html"
pk_url_kwarg = 'map_id'
def render_to_response(self, context, **response_kwargs):
......@@ -171,7 +171,7 @@ class UpdateMapExtent(UpdateView):
class UpdateMapPermissions(UpdateView):
template_name = "chickpea/map_update_permissions.html"
template_name = "leaflet_storage/map_update_permissions.html"
model = Map
form_class = UpdateMapPermissionsForm
pk_url_kwarg = 'map_id'
......@@ -192,7 +192,7 @@ class UpdateMapPermissions(UpdateView):
class UpdateMapTileLayers(TemplateView):
template_name = "chickpea/map_update_tilelayers.html"
template_name = "leaflet_storage/map_update_tilelayers.html"
pk_url_kwarg = 'map_id'
def get_context_data(self, **kwargs):
......@@ -222,7 +222,7 @@ class UpdateMapTileLayers(TemplateView):
class UploadData(FormView):
template_name = "chickpea/upload_form.html"
template_name = "leaflet_storage/upload_form.html"
form_class = UploadDataForm
pk_url_kwarg = 'map_id'
......@@ -286,7 +286,7 @@ class UploadData(FormView):
class EmbedMap(DetailView):
model = Map
template_name = "chickpea/map_embed.html"
template_name = "leaflet_storage/map_embed.html"
pk_url_kwarg = 'map_id'
def get_context_data(self, **kwargs):
......@@ -366,7 +366,7 @@ class FeatureView(DetailView):
extendable.
"""
templates = super(FeatureView, self).get_template_names()
templates.append("chickpea/feature_detail.html")
templates.append("leaflet_storage/feature_detail.html")
return templates
......@@ -392,7 +392,7 @@ class FeatureAdd(CreateView):
extendable.
"""
templates = super(FeatureAdd, self).get_template_names()
templates.append("chickpea/feature_form.html")
templates.append("leaflet_storage/feature_form.html")
return templates
......@@ -425,13 +425,13 @@ class FeatureUpdate(UpdateView):
extendable.
"""
templates = super(FeatureUpdate, self).get_template_names()
templates.append("chickpea/feature_form.html")
templates.append("leaflet_storage/feature_form.html")
return templates
class FeatureDelete(DeleteView):
context_object_name = "feature"
template_name = "chickpea/feature_confirm_delete.html"
template_name = "leaflet_storage/feature_confirm_delete.html"
def render_to_response(self, context, **response_kwargs):
return render_to_json(self.get_template_names(), response_kwargs, context, self.request)
......
......@@ -5,19 +5,19 @@ import codecs
from setuptools import setup, find_packages
import chickpea
import leaflet_storage
long_description = codecs.open('README.rst', "r", "utf-8").read()
setup(
name="chickpea",
version=chickpea.__version__,
author=chickpea.__author__,
author_email=chickpea.__contact__,
description=chickpea.__doc__,
name="leaflet_storage",
version=leaflet_storage.__version__,
author=leaflet_storage.__author__,
author_email=leaflet_storage.__contact__,
description=leaflet_storage.__doc__,
keywords="django leaflet geodjango",
url=chickpea.__homepage__,
download_url="https://github.com/yohanboniface/django-chickpea/downloads",
url=leaflet_storage.__homepage__,
download_url="https://github.com/yohanboniface/django-leaflet-storage/downloads",
packages=find_packages(),
include_package_data=True,
platforms=["any"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment