Comments (3)
And this how my shared CreateView looks like :
class BaseCreateView(CreateView):
template_name = 'stock/item-form.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
verbose_name = self.model._meta.verbose_name
context["page_title"] = _('Create new {}'.format(verbose_name))
context["action_type"] = "create"
return context
def form_valid(self, form):
form.instance.created_by = self.request.user
form.instance.updated_by = self.request.user
form.instance.created_at = timezone.now()
form.instance.updated_at = timezone.now()
form.instance.base_company = self.request.user.current_company
return super().form_valid(form)
def get_success_url(self):
return reverse_lazy('{}:detail'.format(self.model._meta.object_name), kwargs={'pk': self.object.pk})
class Meta:
abstract = True
from django-ledger.
I agree with your approach. Django Ledger makes use of MixIns to encapsulate common behavior among views and avoid repetition. Can you suggest changes to the Django Ledger code to accomplish what you are proposing?
Thanks
from django-ledger.
The code has been refactored since version 0.4 to incorporate good practices like the one described on this issue.
from django-ledger.
Related Issues (20)
- Audit Trail and Logging records
- Adding validations and Check for the User Inputs to the fields HOT 1
- Adding More Columns for capturing Other Important Details of the Vendor , Customer, Items HOT 3
- Assets Number : Assets Accounting should always be Unique across an entity for lifetime.
- Please create a requirements.txt file
- TypeError after Get request to '/ledger/entity/create/' with all the optional fields checked. HOT 3
- I can't install HOT 6
- Journals entries timestamps are all recorded as midnight regardless of the timezone
- A server error occurred. Please contact the administrator. HOT 1
- python manage.py runserver Not working. HOT 3
- The invite link for discord is invalid or expired HOT 3
- KeyError at /admin/django_ledger/entitymodel/<UUID>/change/ HOT 2
- import from ledger/hledger and similar plain text accounting formats HOT 1
- docker compose file HOT 4
- VAT (value added tax) HOT 2
- RuntimeError: A durable atomic block cannot be nested within another atomic block. HOT 1
- Discord-link not working / Chat-GPT writes nonsense HOT 1
- ValidationError HOT 1
- Support variations in OFX files provided by banks HOT 2
- AttributeError: 'RelatedManager' object has no attribute 'posted' on account detailed view HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-ledger.