zeraien / django-url-framework Goto Github PK
View Code? Open in Web Editor NEWAutomagic url discovery for django (like in Ruby on Rails), with a Controller -> Action -> View methodology.
Home Page: onedaybeard.com
License: MIT License
Automagic url discovery for django (like in Ruby on Rails), with a Controller -> Action -> View methodology.
Home Page: onedaybeard.com
License: MIT License
The readme file is pretty comprehensive, but does not quite cover everything.
Please help upgrade the package to be compatible with Django 2.2 and Python3
ActionController is extended by user controllers but also contains all the inner workings of the framework. In order to make it easier to see what methods are useful for a subclass and which methods are just turning the gears, I'll move all the functionality into a separate class or classes. The framework is long overdue for a refactoring anyway.
in setup.py
In controller.py line #91 is commented out -- this removes the ability to have /cart/(\d+) auto-generated. What was the problem it caused? I uncommented it and it seemed to work.
Right now you need to specify action settings as function parameters, like so:
def submit(self, request):
return {}
submit.allowed_methods = ['POST']
I'm thinking it might be smarter to do something like this:
from django_url_framework.decorators import post
@post
def submit(self, request):
return {}
Which would limit it to POST only. Adding multiple decorators can limit it to multiple methods.
If you attempt to use self._go
, with an invalid action, the error message is not correct.
Instead you get:
AttributeError: 'InvalidActionError' object has no attribute 'message'
** Example code to explain the scenario**
Specifically the functions with objects.
def edit(self, request, id = None):
return HttpResponse('edit')
/cart/edit/id/ --> working fine
@login_required
def edit2(self, request, id = None):
return HttpResponse('index2')
/cart/edit2/id/ --> 404 error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.