Merge branch 'demo_site_integration'
This commit is contained in:
		
						commit
						d796b0de32
					
				
					 7 changed files with 46 additions and 128 deletions
				
			
		| 
						 | 
					@ -1,51 +0,0 @@
 | 
				
			||||||
<!--- Sample template. Move elsewhere once it's ready to go. -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% extends "site_base.html" %}
 | 
					 | 
				
			||||||
{% block body %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<h1>Invoice {{ invoice.id }}</h1>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<ul>
 | 
					 | 
				
			||||||
  <li>Void: {{ invoice.void }}</li>
 | 
					 | 
				
			||||||
  <li>Paid: {{ invoice.paid }}</li>
 | 
					 | 
				
			||||||
</ul>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<table>
 | 
					 | 
				
			||||||
  <tr>
 | 
					 | 
				
			||||||
    <th>Description</th>
 | 
					 | 
				
			||||||
    <th>Quantity</th>
 | 
					 | 
				
			||||||
    <th>Price/Unit</th>
 | 
					 | 
				
			||||||
    <th>Total</th>
 | 
					 | 
				
			||||||
  </tr>
 | 
					 | 
				
			||||||
  {% for line_item in invoice.lineitem_set.all %}
 | 
					 | 
				
			||||||
    <tr>
 | 
					 | 
				
			||||||
      <td>{{line_item.description}}</td>
 | 
					 | 
				
			||||||
      <td>{{line_item.quantity}}</td>
 | 
					 | 
				
			||||||
      <td>{{line_item.price}}</td>
 | 
					 | 
				
			||||||
      <td><!-- multiply --> FIXME</td>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
  {% endfor %}
 | 
					 | 
				
			||||||
  <tr>
 | 
					 | 
				
			||||||
    <th>TOTAL</th>
 | 
					 | 
				
			||||||
    <td></td>
 | 
					 | 
				
			||||||
    <td></td>
 | 
					 | 
				
			||||||
    <td>{{ invoice.value }}</td>
 | 
					 | 
				
			||||||
  </tr>
 | 
					 | 
				
			||||||
</table>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<table>
 | 
					 | 
				
			||||||
  <tr>
 | 
					 | 
				
			||||||
    <th>Payment time</th>
 | 
					 | 
				
			||||||
    <th>Reference</th>
 | 
					 | 
				
			||||||
    <th>Amount</th>
 | 
					 | 
				
			||||||
  </tr>
 | 
					 | 
				
			||||||
  {% for payment in invoice.payment_set.all %}
 | 
					 | 
				
			||||||
    <tr>
 | 
					 | 
				
			||||||
      <td>{{payment.time}}</td>
 | 
					 | 
				
			||||||
      <td>{{payment.reference}}</td>
 | 
					 | 
				
			||||||
      <td>{{payment.amount}}</td>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
  {% endfor %}
 | 
					 | 
				
			||||||
</table>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% endblock %}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,50 +0,0 @@
 | 
				
			||||||
<!--- Sample template. Move elsewhere once it's ready to go. -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% extends "site_base.html" %}
 | 
					 | 
				
			||||||
{% block body %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <h1>Product Category: {{ category.name }}</h1>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <form method="post" action="">
 | 
					 | 
				
			||||||
    {% csrf_token %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <table>
 | 
					 | 
				
			||||||
        {{ voucher_form }}
 | 
					 | 
				
			||||||
    </table>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <p><input type="submit"></p>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    {% if discounts %}
 | 
					 | 
				
			||||||
      <h3>Available Discounts</h3>
 | 
					 | 
				
			||||||
      <ul>
 | 
					 | 
				
			||||||
        {% for discount in discounts %}
 | 
					 | 
				
			||||||
          <li>{{ discount.quantity }} x
 | 
					 | 
				
			||||||
            {% if discount.clause.percentage %}
 | 
					 | 
				
			||||||
              {{ discount.clause.percentage|floatformat:"2" }}%
 | 
					 | 
				
			||||||
            {% else %}
 | 
					 | 
				
			||||||
              ${{ discount.clause.price|floatformat:"2" }}
 | 
					 | 
				
			||||||
            {% endif %}
 | 
					 | 
				
			||||||
            off
 | 
					 | 
				
			||||||
            {% if discount.clause.category %}
 | 
					 | 
				
			||||||
              {{ discount.clause.category }}
 | 
					 | 
				
			||||||
            {% else %}
 | 
					 | 
				
			||||||
              {{ discount.clause.product.category }}
 | 
					 | 
				
			||||||
              - {{ discount.clause.product }}
 | 
					 | 
				
			||||||
            {% endif %}
 | 
					 | 
				
			||||||
          </li>
 | 
					 | 
				
			||||||
        {% endfor %}
 | 
					 | 
				
			||||||
      </ul>
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <h3>Available Products</h3>
 | 
					 | 
				
			||||||
    <p>{{ category.description }}</p>
 | 
					 | 
				
			||||||
    <table>
 | 
					 | 
				
			||||||
        {{ form }}
 | 
					 | 
				
			||||||
    </table>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <p><input type="submit"></p>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  </form>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% endblock %}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,22 +0,0 @@
 | 
				
			||||||
<!--- Sample template. Move elsewhere once it's ready to go. -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% extends "site_base.html" %}
 | 
					 | 
				
			||||||
{% block body %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <h1>Attendee Profile</h1>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <p>Something something fill in your attendee details here!</p>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <form method="post" action="">
 | 
					 | 
				
			||||||
    {% csrf_token %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <table>
 | 
					 | 
				
			||||||
        {{ form }}
 | 
					 | 
				
			||||||
    </table>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <input type="submit">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  </form>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% endblock %}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@ urlpatterns = patterns(
 | 
				
			||||||
    url(r"^checkout$", "checkout", name="checkout"),
 | 
					    url(r"^checkout$", "checkout", name="checkout"),
 | 
				
			||||||
    url(r"^invoice/([0-9]+)$", "invoice", name="invoice"),
 | 
					    url(r"^invoice/([0-9]+)$", "invoice", name="invoice"),
 | 
				
			||||||
    url(r"^invoice/([0-9]+)/pay$", "pay_invoice", name="pay_invoice"),
 | 
					    url(r"^invoice/([0-9]+)/pay$", "pay_invoice", name="pay_invoice"),
 | 
				
			||||||
    url(r"^profile$", "edit_profile", name="profile"),
 | 
					    url(r"^profile$", "edit_profile", name="attendee_edit"),
 | 
				
			||||||
    url(r"^register$", "guided_registration", name="guided_registration"),
 | 
					    url(r"^register$", "guided_registration", name="guided_registration"),
 | 
				
			||||||
    url(r"^register/([0-9]+)$", "guided_registration",
 | 
					    url(r"^register/([0-9]+)$", "guided_registration",
 | 
				
			||||||
        name="guided_registration"),
 | 
					        name="guided_registration"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,7 +82,7 @@ def edit_profile(request):
 | 
				
			||||||
    data = {
 | 
					    data = {
 | 
				
			||||||
        "form": form,
 | 
					        "form": form,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return render(request, "profile_form.html", data)
 | 
					    return render(request, "registrasion/profile_form.html", data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ def product_category(request, category_id):
 | 
				
			||||||
        "voucher_form": voucher_form,
 | 
					        "voucher_form": voucher_form,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return render(request, "product_category.html", data)
 | 
					    return render(request, "registrasion/product_category.html", data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def handle_products(request, category, products, prefix):
 | 
					def handle_products(request, category, products, prefix):
 | 
				
			||||||
| 
						 | 
					@ -188,7 +188,10 @@ def handle_products(request, category, products, prefix):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@transaction.atomic
 | 
					@transaction.atomic
 | 
				
			||||||
def set_quantities_from_products_form(products_form, current_cart):
 | 
					def set_quantities_from_products_form(products_form, current_cart):
 | 
				
			||||||
    for product_id, quantity, field_name in products_form.product_quantities():
 | 
					    # TODO: issue #8 is a problem here.
 | 
				
			||||||
 | 
					    quantities = list(products_form.product_quantities())
 | 
				
			||||||
 | 
					    quantities.sort(key=lambda item: item[1])
 | 
				
			||||||
 | 
					    for product_id, quantity, field_name in quantities:
 | 
				
			||||||
        product = rego.Product.objects.get(pk=product_id)
 | 
					        product = rego.Product.objects.get(pk=product_id)
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            current_cart.set_quantity(product, quantity, batched=True)
 | 
					            current_cart.set_quantity(product, quantity, batched=True)
 | 
				
			||||||
| 
						 | 
					@ -251,7 +254,7 @@ def invoice(request, invoice_id):
 | 
				
			||||||
        "invoice": current_invoice.invoice,
 | 
					        "invoice": current_invoice.invoice,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return render(request, "invoice.html", data)
 | 
					    return render(request, "registrasion/invoice.html", data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								requirements/base.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								requirements/base.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					django-nested-admin==2.2.6
 | 
				
			||||||
 | 
					#-e git+https://github.com/pinax/symposion.git#egg=SymposionMaster # Needs Symposion
 | 
				
			||||||
							
								
								
									
										36
									
								
								setup.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								setup.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,36 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					from setuptools import setup, find_packages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import registrasion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def read_file(filename):
 | 
				
			||||||
 | 
					    """Read a file into a string."""
 | 
				
			||||||
 | 
					    path = os.path.abspath(os.path.dirname(__file__))
 | 
				
			||||||
 | 
					    filepath = os.path.join(path, filename)
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        return open(filepath).read()
 | 
				
			||||||
 | 
					    except IOError:
 | 
				
			||||||
 | 
					        return ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					setup(
 | 
				
			||||||
 | 
					    name="registrasion",
 | 
				
			||||||
 | 
					    author="Christopher Neugebauer",
 | 
				
			||||||
 | 
					    author_email="_@chrisjrn.com",
 | 
				
			||||||
 | 
					    version=registrasion.__version__,
 | 
				
			||||||
 | 
					    description="A registration app for the Symposion conference management system.",
 | 
				
			||||||
 | 
					    url="http://github.com/chrisjrn/registrasion/",
 | 
				
			||||||
 | 
					    packages=find_packages(),
 | 
				
			||||||
 | 
					    include_package_data=True,
 | 
				
			||||||
 | 
					    classifiers=(
 | 
				
			||||||
 | 
					        "Development Status :: 2 - Pre-Alpha",
 | 
				
			||||||
 | 
					        "Programming Language :: Python",
 | 
				
			||||||
 | 
					        "Framework :: Django",
 | 
				
			||||||
 | 
					        "Intended Audience :: Developers",
 | 
				
			||||||
 | 
					        "Natural Language :: English",
 | 
				
			||||||
 | 
					        "License :: OSI Approved :: Apache Software License",
 | 
				
			||||||
 | 
					    ),
 | 
				
			||||||
 | 
					    install_requires=read_file("requirements/base.txt").splitlines(),
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue