Skip to content

Commit

Permalink
bump version, breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
asifpy committed Apr 11, 2016
1 parent 05b9d18 commit 9b088f3
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 46 deletions.
38 changes: 2 additions & 36 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Features:
- Separate CREATE and UPDATE forms
- Define your own custom queryset for list view
- Inline Formset support for parent child models
- Default Bootstrap3 CSS

Prerequisites
-------------
Expand Down Expand Up @@ -70,6 +71,7 @@ Usage
LOGIN_REQUIRED_FOR_CRUD = True/False
PERMISSION_REQUIRED_FOR_CRUD = True/False
PROJECT_NAME = 'YOUR PROJECT NAME'
**Create models in yourapp/models.py**

Expand Down Expand Up @@ -194,41 +196,5 @@ Added mixin which allows access to additional template variables like app lable
PLURIZED MODEL : {{pluralized_model_name}}
EXTENDABLE
----------
All the generated views/tables/forms/url are extendable.

.. code-block:: python
# GENERATE CRUD CLASSES
from crudbuilder.views import ViewBuilder
builder = ViewBuilder('example', 'person', crudclass)
builder.generate_crud()
builder.classes
{'PersonCreateView': <class 'django.views.generic.edit.PersonCreateView'>,
'PersonDeleteView': <class 'crudbuilder.views.PersonDeleteView'>,
'PersonListView': <class 'crudbuilder.views.PersonListView'>,
'PersonUpdateView': <class 'django.views.generic.edit.PersonUpdateView'>,
'PersonDetailView': <class 'crudbuilder.views.PersonDetailView'>
}
# OVERRIDE AUTO GENERATED VIEWS
from crudbuilder.views import ViewBuilder
builder = ViewBuilder('example', 'person')
builder.generate_crud()
PersonListView = builder.classes['PersonListView']
class CustomPersonListView(PersonListView):
def get_context_data(self, **kwargs):
context = super(CustomPersonListView, self).get_context_data(**kwargs)
context['your_template_variable'] = 'Your new template variable'
return context
# OVERRIDE AUTO GENERATED TABLE (from django_tables2)
from crudbuilder.tables import TableBuilder
builder = TableBuilder('example', 'person')
PersonTable = builder.generate_table()
class CustomPersonTable(PersonTable):
# add your custom implementation here
2 changes: 1 addition & 1 deletion crudbuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
registry
)

VERSION = '0.1.9'
VERSION = '0.1.10'
7 changes: 7 additions & 0 deletions crudbuilder/templates/inline/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
{% load tags %}
{% load staticfiles %}

{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li class="active">Create {{actual_model_name}}</li>
</ul>
{% endblock %}


{% block js %}
<script type="text/javascript" src="{% static 'crudbuilder/js/jquery.formset.js' %}"></script>
Expand Down
25 changes: 20 additions & 5 deletions crudbuilder/templates/inline/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@

{% load tags %}

{% block css %}
<style>
.btn{
margin-right:10px;
}
</style>
{% endblock %}


{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li class="active">{{object}}</li>
</ul>
{% endblock %}

{% block main_content %}
{% block actions %}
<a class="btn btn-primary" href="{% url app_label|add:'-'|add:actual_model_name|add:'-update' object.id %}"><i class="glyphicon glyphicon-pencil"></i> Update</a>
<a class="btn btn-primary" href="{% url app_label|add:'-'|add:actual_model_name|add:'-delete' object.id %}"><i class="glyphicon glyphicon-remove-sign"></i> Delete</a>
{% endblock %}
<hr/>
{% block actions %}
<a class="btn btn-primary pull-right" href="{% url app_label|add:'-'|add:actual_model_name|add:'-update' object.id %}"><i class="glyphicon glyphicon-pencil"></i> Update</a>
<a class="btn btn-primary pull-right" href="{% url app_label|add:'-'|add:actual_model_name|add:'-delete' object.id %}"><i class="glyphicon glyphicon-remove-sign"></i> Delete</a>
{% endblock %}

<div class='container'>
<h3>{{object}}</h3>
Expand Down
8 changes: 8 additions & 0 deletions crudbuilder/templates/instance/create.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{% extends "base.html" %}
{% load tags %}

{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li class="active">Create {{actual_model_name}}</li>
</ul>
{% endblock %}


{% block main_content %}

<div class='container'>
Expand Down
9 changes: 9 additions & 0 deletions crudbuilder/templates/instance/delete.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% extends "base.html" %}
{% load tags %}

{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-detail' object.id %}">{{object}}</a></li>
<li class="active">Delete {{object}}</li>
</ul>
{% endblock %}


{% block main_content %}
<h3>Delete {{actual_model_name}}</h3>

Expand Down
21 changes: 19 additions & 2 deletions crudbuilder/templates/instance/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,27 @@

{% load tags %}

{% block css %}
<style>
.btn{
margin-right:10px;
}
</style>
{% endblock %}


{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li class="active">{{object}}</li>
</ul>
{% endblock %}


{% block main_content %}
{% block actions %}
<a class="btn btn-primary" href="{% url app_label|add:'-'|add:actual_model_name|add:'-update' object.id %}"><i class="glyphicon glyphicon-pencil"></i> Update</a>
<a class="btn btn-primary" href="{% url app_label|add:'-'|add:actual_model_name|add:'-delete' object.id %}"><i class="glyphicon glyphicon-remove-sign"></i> Delete</a>
<a class="btn btn-primary pull-right" href="{% url app_label|add:'-'|add:actual_model_name|add:'-update' object.id %}"><i class="glyphicon glyphicon-pencil"></i> Update</a>
<a class="btn btn-primary pull-right" href="{% url app_label|add:'-'|add:actual_model_name|add:'-delete' object.id %}"><i class="glyphicon glyphicon-remove-sign"></i> Delete</a>
{% endblock %}
<hr/>

Expand Down
9 changes: 7 additions & 2 deletions crudbuilder/templates/instance/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
{% load tags %}
{% load render_table from django_tables2 %}

{% block breadcrumb %}
<ul class="breadcrumb">
<li class="active">{{pluralized_model_name|title}}</li>
</ul>
{% endblock %}

{% block main_content %}

{% block actions %}
<a class="btn btn-primary" href="{% url app_label|add:'-'|add:actual_model_name|add:'-create' %}"><i class="glyphicon glyphicon-plus-sign"></i> Add {{actual_model_name|title}}</a>
<a class="btn btn-primary pull-right" href="{% url app_label|add:'-'|add:actual_model_name|add:'-create' %}"><i class="glyphicon glyphicon-plus-sign"></i> Add {{actual_model_name|title}}</a>
{% endblock %}
<hr/>

<div class='container'>

Expand Down
9 changes: 9 additions & 0 deletions crudbuilder/templates/instance/update.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% extends "base.html" %}
{% load tags %}

{% block breadcrumb %}
<ul class="breadcrumb">
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-list' %}">{{pluralized_model_name|title}}</a></li>
<li><a href="{% url app_label|add:'-'|add:actual_model_name|add:'-detail' object.id %}">{{object}}</a></li>
<li class="active">Update {{object}}</li>
</ul>
{% endblock %}


{% block main_content %}

<div class='container'>
Expand Down
2 changes: 2 additions & 0 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Features
- Add your own templates for List/Create/Detail/Update/Delete views
- Separate CREATE and UPDATE forms
- Define your own custom queryset for list view
- Inline Formset support for parent child models
- Default Bootstrap3 CSS


Requirements and Compatibility
Expand Down

0 comments on commit 9b088f3

Please sign in to comment.