The essentials of Cucumber-JVM and Spock - a handbook written for the BDD/TDD Masterclass (https://johnfergusonsmart.com/programs-courses/bdd-tdd-clean-coding/)
Introduction to the Spring Framework:
Generar description
IoC container
Dependency Injection
Beans scope and lifecycle
Autowiring
XML and annotation based configuration
Additional features
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
The essentials of Cucumber-JVM and Spock - a handbook written for the BDD/TDD Masterclass (https://johnfergusonsmart.com/programs-courses/bdd-tdd-clean-coding/)
Introduction to the Spring Framework:
Generar description
IoC container
Dependency Injection
Beans scope and lifecycle
Autowiring
XML and annotation based configuration
Additional features
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Spring boot is a great and relatively a new project from Spring.io. The presentation discusses about basics of spring boot to advance topics. Sample demo apps are available here : https://github.com/bhagwat/spring-boot-samples
Hands-On Java web passando por Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...Mario Jorge Pereira
Material sobre Java WEB super mão na massa. Vou construindo e alterando uma aplicação durante a apresentação os assuntos cobertos são:
Java Servlet
Java Server Pages - JSP
JavaServer Pages Standard Tag Library - JSTL
Expression Language - EL
Java Database Connectivity - JDBC
Data Access Object - DAO
Model View Controller - MVC
Hibernate
...
Apresento também formas de fugir do sqlinjection
Java 8 Stream API. A different way to process collections.David Gómez García
A look on one of the features of Java 8 hidden behind the lambdas. A different way to iterate Collections. You'll never see the Collecions the same way.
These are the slides I used on my talk at the "Tech Thursday" by Oracle in June in Madrid.
Spring MVC 3.0 Framework
Objective:
1. Introduce Spring MVC Module
2. Learn about Spring MVC Components (Dispatcher, Handler mapping, Controller, View Resolver, View)
Slides:
1. What Is Spring?
2. Why use Spring?
3. By the way, just what is MVC?
4. MVC Architecture
5. Spring MVC Architecture
7. Spring MVC Components
8. DispatcherServlet
9. DispatcherServlet Architecture.........
.........................................................
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
Presentation on MongoDB and Node.JS. We describe how to do basic CRUD operations (insert, remove, update, find) how to aggregate using node.js. We also discuss a bit of Meteor, MEAN Stack and other ODMs and projects on Javascript and MongoDB
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
Introduction to Spring Framework and Spring IoCFunnelll
An introduction to the building blocks of the Spring framework. The presentation focuses on Spring Inverse of Control Container (IoC) ,how it used in the LinkedIn stack, how it integrates with other frameworks and how it works with your JUnit testing.
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
Django Meetup Bogotá. Class Based Views con ejemplos. Class Based Views with examples.
Código fuente: https://bitbucket.org/vero4ka/cbvexamples
Class Based Views with examles.
Spring boot is a great and relatively a new project from Spring.io. The presentation discusses about basics of spring boot to advance topics. Sample demo apps are available here : https://github.com/bhagwat/spring-boot-samples
Hands-On Java web passando por Servlets, JSP, JSTL, JDBC, Hibernate, DAO, MV...Mario Jorge Pereira
Material sobre Java WEB super mão na massa. Vou construindo e alterando uma aplicação durante a apresentação os assuntos cobertos são:
Java Servlet
Java Server Pages - JSP
JavaServer Pages Standard Tag Library - JSTL
Expression Language - EL
Java Database Connectivity - JDBC
Data Access Object - DAO
Model View Controller - MVC
Hibernate
...
Apresento também formas de fugir do sqlinjection
Java 8 Stream API. A different way to process collections.David Gómez García
A look on one of the features of Java 8 hidden behind the lambdas. A different way to iterate Collections. You'll never see the Collecions the same way.
These are the slides I used on my talk at the "Tech Thursday" by Oracle in June in Madrid.
Spring MVC 3.0 Framework
Objective:
1. Introduce Spring MVC Module
2. Learn about Spring MVC Components (Dispatcher, Handler mapping, Controller, View Resolver, View)
Slides:
1. What Is Spring?
2. Why use Spring?
3. By the way, just what is MVC?
4. MVC Architecture
5. Spring MVC Architecture
7. Spring MVC Components
8. DispatcherServlet
9. DispatcherServlet Architecture.........
.........................................................
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
Presentation on MongoDB and Node.JS. We describe how to do basic CRUD operations (insert, remove, update, find) how to aggregate using node.js. We also discuss a bit of Meteor, MEAN Stack and other ODMs and projects on Javascript and MongoDB
Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
Introduction to Spring Framework and Spring IoCFunnelll
An introduction to the building blocks of the Spring framework. The presentation focuses on Spring Inverse of Control Container (IoC) ,how it used in the LinkedIn stack, how it integrates with other frameworks and how it works with your JUnit testing.
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
Django Meetup Bogotá. Class Based Views con ejemplos. Class Based Views with examples.
Código fuente: https://bitbucket.org/vero4ka/cbvexamples
Class Based Views with examles.
Gutenberg sous le capot, modules réutilisablesRiad Benguella
Gutenberg arrive, ça change tout pour ce qui est de la création de contenu dans WordPress. Mais ce que vous ne savez pas c’est que Gutenberg a le potentiel pour changer beaucoup de choses pour les développeurs de plugins et de thèmes WordPress et même à l’extérieur de la communauté WordPress.
De la gestion des données de votre plugin, la gestion des dates, l’internationalisation à l’interface UI, Gutenberg est une mine d’or qui ne demande qu’à être exploitée. Explorons ensemble l’architecture modulaire de Gutenberg et apprenons à réutiliser ses modules pour ses propres projets.
This is a small introduction to the django framework I did for fellow engineers at Anevia. It touches on many of the major concepts and core features of django and gives a typical workflow built about the example of a minimalist blog engine.
Writing HTML5 Web Apps using Backbone.js and GAERon Reiter
A walkthrough of how to write a complete HTML5 web app (both front end and back end) using Google App Engine (Python), Backbone.js, Require.js, underscore.js and jQuery.
28.03.15. Одесса. Impact Hub Odessa. Конференция JSLab.
Алексей Волков. "React на практике"
Доклад освещает практические аспекты использования React.js в различном окружении. React и модели Backbone. React и таблицы стилей, а также React в мобильном вебе. Будет полезно как и тем, кто только интересуется этой библиотекой, а также опытным разработчикам.
Подробнее:
http://geekslab.co/
https://www.facebook.com/GeeksLab.co
https://www.youtube.com/user/GeeksLabVideo
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
28. Dispatch HTTP Verbs
from django.http import HttpResponse
def my_view(request):
if request.method == 'GET':
# view logic
return HttpResponse('result')
if request.method == 'POST':
# view logic
return HttpResponse('result')
from django.views.generic import View
from django.http import HttpResponse
class MyView(View):
?
?
29. dispatch()
def dispatch(self, request, *args, **kwargs):
# Try to dispatch to the right method;
# if a method doesn't exist, defer to the error handler.
# Also defer to the error handler if the
# request method isn't on the approved list.
if request.method.lower() in self.http_method_names:
handler = getattr(self, request.method.lower(), self.http_method_not_allowed)
else:
handler = self.http_method_not_allowed
return handler(request, *args, **kwargs)
30. From FBV to CBV
FBV CBV
from django.http import HttpResponse
def my_view(request):
if request.method == 'GET':
# view logic
return HttpResponse('result')
if request.method == 'POST':
# view logic
return HttpResponse('result')
from django.views.generic import View
from django.http import HttpResponse
class MyView(View):
def get(self, request):
# view logic
return HttpResponse('result')
def post(self, request):
# view logic
return HttpResponse('result')
32. Display A Blog Post (FBV v.s. CBV)
http://blog.mysite.com/post/12997/
FBV CBV
def post_detail(request, pk):
post = get_object_or_404(Post, pk=pk)
return render(request,
'post_detail.html',
{'post’: post})
class PostDetailView(DetailView):
model = Post
42. class SecretMessageMixin(object):
def get_context_data(self,**kwargs):self).get_context_data(**kwargs)
context[“secret_message] = ‘Hello’
return context
class PostDetailView(SecretMessageMixin, DetailView):
model = Post
Customize - Mixins
{% extends ‘base.html’ %}
div
Secret Message is {{ secret_message }}
/div
views.py
post_detail.html
43. Mixins
1. Mixins should inherit from Python’s built-in object type
2. Base view by Django always go to the right
3. Mixins go to the left of the base view
class SecretMessageMixin(object):
…
class PostDetailView(SecretMessageMixin, DetailView):
model = Post
1
3 2
45. Tip1. Access Control
from django.contrib.auth.decorators import login_required
class LoginRequiredMixin(object):
@classmethod
def as_view(cls, **initkwargs):
view = super(LoginRequiredMixin, cls).as_view(**initkwargs)
return login_required(view)
class PostDetail(LoginRequiredMixin, DetailView):
model = Post
47. Tip2. Where should I put my code ?
dispatch()
get_context_data()
form_valid()
form_invalid()
get_queryset()
• Custom actions on every Http request
• Add additional object to context
• Custom Actions on Views with Valid Forms
• Custom Actions on Views with Invalid Forms
• Filter posts by query string
48. Custom Actions on Views with Valid Forms form_valid()
Custom Actions on Views with Invalid Forms form_invalid()
from django.views.generic import CreateView
from braces.views import LoginRequiredMixin
from .models import Post
class PostCreateView(LoginRequiredMixin, CreateView):
model = Post
fields = ('title', ‘content')
def form_invalid(self, form):
# Do custom logic
return super(PostCreateView, self).form_valid(form)
def form_valid(self, form):
# Do custom logic
return super(PostCreateView, self).form_valid(form)
49. Filter posts by query string get_queryset()
from django.views.generic import ListView
from .models import Post
class PostListView(ListView):
model = Post
def get_queryset(self):
queryset = super(PostListView, self).get_queryset()
q = self.request.GET.get('q')
if q:
queryset = qs.filter(title__icontains=q)
return queryset
{# templates/blog/_post_search.html #}
form action={% url “post-list %} method=GET
input type=text name=q/
button type=submitSearch/
/form
50. Tip3. Access url parameters
http://blog.mysite.com/author/john/
url(r’^author/(?Pusernamew+)/$’, AuthorPostListView.as_view())
from django.views.generic import ListView
from .models import Post
class AuthorPostListView.as_view(ListView):
model = Post
paginate_by = 10
def get_queryset(self):
user = get_object_or_404(User, username=self.kwargs['author'])
queryset = super(AuthorPostListView.as_view, self).get_queryset()
return queryset.filter(author=user)
51. Tip4. Using the View Object
class PostMixin(object):
@cached_property
def likes_and_favorites(self):
likes = self.objects.likes()
favorites = self.objects.favorites()
return {
'likes': likes,
'favorites': favorites,
'favorites_count': favorites.count(),
}
from django.utils.functional import cached_property
from django.views.generic import UpdateView
from .tasks import notify_users_who_favorited
class PostUpdateView(PostMixin, UpdateView):
model = Post
fields = ('title', 'content')
def form_valid(self, form):
notify_users_who_favorited(
instance=self.object,
favorites = self.like_and_favorites['favorites']
)
58. Guidelines
• Less view code is better
• Never repeat code in views
• Views should handle presentation logic
• Keep your view simple
• Use FBV for 403, 404, 500 error handlers
• Keep your mixins simple