pandas-profiling 1.4.1 released - Create beautiful HTML profiling reports from pandas DataFrame objects
https://github.com/pandas-profiling/pandas-profiling
/r/pystats
https://redd.it/7pg7h0
https://github.com/pandas-profiling/pandas-profiling
/r/pystats
https://redd.it/7pg7h0
GitHub
GitHub - ydataai/ydata-profiling: 1 Line of code data quality profiling & exploratory data analysis for Pandas and Spark DataFrames.
1 Line of code data quality profiling & exploratory data analysis for Pandas and Spark DataFrames. - GitHub - ydataai/ydata-profiling: 1 Line of code data quality profiling & explo...
[Q] Need help in understanding how a part of flask works.
Hi r/Flask
I was following Miguel Grinberg refreshed flask mega tutorial and had a small doubt in one section.
for whatever reason, I was unable to post a comment there so I decided to seek the expertise of you folks here.
so here's the question (and relevant code snippet).
@app.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
flash('Login requested for user {}, remember_me={}'.format(
form.username.data, form.remember_me.data))
return redirect('/index')
return render_template('login.html', title='Sign In', form=form)
I don't completely understand the flow of the program when the login url is visited.
Could someone please explain how the " form.validate_on_submit() " is evaluated before the user enters data into the form and clicks the submit button, which I believe is only possible when the login function has returned and rendered the login template ?
Thanks !
/r/flask
https://redd.it/7pfz3w
Hi r/Flask
I was following Miguel Grinberg refreshed flask mega tutorial and had a small doubt in one section.
for whatever reason, I was unable to post a comment there so I decided to seek the expertise of you folks here.
so here's the question (and relevant code snippet).
@app.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
flash('Login requested for user {}, remember_me={}'.format(
form.username.data, form.remember_me.data))
return redirect('/index')
return render_template('login.html', title='Sign In', form=form)
I don't completely understand the flow of the program when the login url is visited.
Could someone please explain how the " form.validate_on_submit() " is evaluated before the user enters data into the form and clicks the submit button, which I believe is only possible when the login function has returned and rendered the login template ?
Thanks !
/r/flask
https://redd.it/7pfz3w
reddit
[Q] Need help in understanding how a part of flask works. • r/flask
Hi r/Flask I was following Miguel Grinberg refreshed flask mega tutorial and had a small doubt in one section. for whatever reason, I was unable...
Changing jinja2 configuration with flask trim_blocks and lstrip_blocks
So I want to change `trim_blocks` and `lstrip_blocks` to true to remove the ugly whitespace you get when you render a template but I can't seem to figure out how to it correctly. I found that I can make a Jinja environment with my own config but this makes it so I have to do `environment.get_template('index.html').render(var=var)` instead of simply `render_template('index.html', var=var)`. Also with this I need to specify the loader for it to know where to find the templates and it breaks flask-bootstrap.
/r/flask
https://redd.it/7ph5na
So I want to change `trim_blocks` and `lstrip_blocks` to true to remove the ugly whitespace you get when you render a template but I can't seem to figure out how to it correctly. I found that I can make a Jinja environment with my own config but this makes it so I have to do `environment.get_template('index.html').render(var=var)` instead of simply `render_template('index.html', var=var)`. Also with this I need to specify the loader for it to know where to find the templates and it breaks flask-bootstrap.
/r/flask
https://redd.it/7ph5na
reddit
Changing jinja2 configuration with flask trim_blocks and... • r/flask
So I want to change `trim_blocks` and `lstrip_blocks` to true to remove the ugly whitespace you get when you render a template but I can't seem to...
Has anyone used vaex? Out-of-core dataframes
Recently discovered [vaex](https://docs.vaex.io/en/latest/index.html). I was curious how it compares to using Dask.
/r/pystats
https://redd.it/7pjmi0
Recently discovered [vaex](https://docs.vaex.io/en/latest/index.html). I was curious how it compares to using Dask.
/r/pystats
https://redd.it/7pjmi0
What would be an alternative to matplotlib in python for visualisation?
I've been using matplotlib and plotly for visualisation in python for some time. matplotlib feels very primitive, plots look crude. Plotly has been a nice ride but it's not free and had to give it up. Are there any better alternatives?
I'd mostly be working in bivariate analysis and time series analysis and more than often want to produce geographical overlays/plots.
/r/Python
https://redd.it/7pg3nu
I've been using matplotlib and plotly for visualisation in python for some time. matplotlib feels very primitive, plots look crude. Plotly has been a nice ride but it's not free and had to give it up. Are there any better alternatives?
I'd mostly be working in bivariate analysis and time series analysis and more than often want to produce geographical overlays/plots.
/r/Python
https://redd.it/7pg3nu
reddit
What would be an alternative to matplotlib in python... • r/Python
I've been using matplotlib and plotly for visualisation in python for some time. matplotlib feels very primitive, plots look crude. Plotly has...
Achoo (the predictive asthma alert system built with the raspberry pi) Beta version 0.1 is now available!
Find the blog post [here](https://tmthyjames.github.io/tools/prediction/Achoo-beta-0.1/).
The app is at [achoo.us](https://achoo.us/).
The github page is [here](https://github.com/tmthyjames/Achoo)
I have been accepted to give a talk about this project at this year's [AnacondaCON](https://anacondacon.io)!
Also, there will inevitably be bugs. This app is still under heavy development and bug fixes will be top priority.
I am grateful for any feedback you have. There are "contact me" buttons on the app and feel free to DM me here too :)
/r/Python
https://redd.it/7pl4ro
Find the blog post [here](https://tmthyjames.github.io/tools/prediction/Achoo-beta-0.1/).
The app is at [achoo.us](https://achoo.us/).
The github page is [here](https://github.com/tmthyjames/Achoo)
I have been accepted to give a talk about this project at this year's [AnacondaCON](https://anacondacon.io)!
Also, there will inevitably be bugs. This app is still under heavy development and bug fixes will be top priority.
I am grateful for any feedback you have. There are "contact me" buttons on the app and feel free to DM me here too :)
/r/Python
https://redd.it/7pl4ro
tmthyjames
Achoo (beta 0.1): A Predictive Ashtma Alert System
Achoo is my way of tracking my son’s allergies and asthma. For the longest time we couldn’t pinpoint exactly what caused his asthmatic episodes. Hopefully this tool will help us track those causes.
Curated collection of python snippets that you can understand in 30 seconds or less (work in progress)
https://github.com/kriadmin/30-seconds-of-python-code
/r/Python
https://redd.it/7pn0qm
https://github.com/kriadmin/30-seconds-of-python-code
/r/Python
https://redd.it/7pn0qm
GitHub
GitHub - 30-seconds/30-seconds-of-python: Short Python code snippets for all your development needs
Short Python code snippets for all your development needs - GitHub - 30-seconds/30-seconds-of-python: Short Python code snippets for all your development needs
[AF] advice about streamlining long running processes
Hi,
I made a Python program that processes large data files. I was asked to make the program accessible through a web interface. I would like to use Flask for this, but i have no experience with Flask yet.
The program flow would be that my colleagues can upload a file and set parameters for the processing > add the job to a queue > process the job > send an email when the job is done > they can download the processed file.
Processing the job is usually done between 5 -15 minutes. What is the preferred way to set this up? I'm worried that because of to the processing time, the website would freeze up and becomes unresponsive.
Is it better to handle the processing separate from my Flask application?
Any advice is greatly appreciated.
/r/flask
https://redd.it/7pn0rd
Hi,
I made a Python program that processes large data files. I was asked to make the program accessible through a web interface. I would like to use Flask for this, but i have no experience with Flask yet.
The program flow would be that my colleagues can upload a file and set parameters for the processing > add the job to a queue > process the job > send an email when the job is done > they can download the processed file.
Processing the job is usually done between 5 -15 minutes. What is the preferred way to set this up? I'm worried that because of to the processing time, the website would freeze up and becomes unresponsive.
Is it better to handle the processing separate from my Flask application?
Any advice is greatly appreciated.
/r/flask
https://redd.it/7pn0rd
reddit
[AF] advice about streamlining long running processes • r/flask
Hi, I made a Python program that processes large data files. I was asked to make the program accessible through a web interface. I would like to...
How to pass an already defined function to "@app.rotue("path")"?
I'm not super good with decorators but I kinda know how they work, but can't get it work.
so I don't want to define my functions and routes in the same file.
@app.route("/")
def home():
return render_template("home.html")
I wanna seperate those in different files.
I thought I can do
def home():
return render_template("home.html")
then
from .controller import home
app.route("/", home)
but it does not work
I hope my question make sense.
/r/flask
https://redd.it/7oyj7t
I'm not super good with decorators but I kinda know how they work, but can't get it work.
so I don't want to define my functions and routes in the same file.
@app.route("/")
def home():
return render_template("home.html")
I wanna seperate those in different files.
I thought I can do
def home():
return render_template("home.html")
then
from .controller import home
app.route("/", home)
but it does not work
I hope my question make sense.
/r/flask
https://redd.it/7oyj7t
reddit
How to pass an already defined function to... • r/flask
I'm not super good with decorators but I kinda know how they work, but can't get it work. so I don't want to define my functions and routes in...
Retrieving lat/long coordinates from the client without requiring a form POST
Is it possible to retrieve the lat/long coordinates immediately after the client "allows" access to their location?
Currently upon agreement to share their location, we'll have access to their coordinates, but only in the browser. How would I send this information server-side ASAP in order to do some processing?
Essentially, how do I skip the POST step after the user agrees to share their coordinates?
/r/django
https://redd.it/7pli92
Is it possible to retrieve the lat/long coordinates immediately after the client "allows" access to their location?
Currently upon agreement to share their location, we'll have access to their coordinates, but only in the browser. How would I send this information server-side ASAP in order to do some processing?
Essentially, how do I skip the POST step after the user agrees to share their coordinates?
/r/django
https://redd.it/7pli92
reddit
Retrieving lat/long coordinates from the client without... • r/django
Is it possible to retrieve the lat/long coordinates immediately after the client "allows" access to their location? Currently upon agreement to...
Co-Worker & Philosophical Differences
I am curious how others have dealt with co-workers who may have had fundamental difference in best practices with co-workers in the past.
Some context:
I have a co-worker (with several years of seniority at this job) who looks at things quite differently than I. While we both agree on KISS, our perspective on what is simple is completely different. We work on primarily "web-applications" but tend to integrate with a lot of external systems.
Some examples:
- The co-worker wants to keep the dependencies as minimal as possible, almost without exception. I agree with not adding complexity needlessly, but am also opposed to reinventing the wheel on the job. Example: limiting ourselves to a document store when the data is very relational in nature. On my end, this adds significant code complexity to perform joins, Cascade deletes, verify relationships are still valid, etc... While data can be structured in a way that makes sense here in some cases, the nesting became too deep for Mongo.
- When dealing with code that would run slower than is acceptable in a single request/response cycle, I would tend to push the logic to Celery, use caching and/or other techniques along those lines. My co-worker does things like spin off a thread from the gunicorn worker or replicates an entire large, external database.
- The co-worker isn't remotely open to the idea of using ORMs on principle. The claim is that you can't optimize if needed (the truth to that statement can be debated) and it adds additional complexity co-worker has to wrap their brain around. However, our applications tend to be small, our deadlines short, and maintainability has been our largest issue historically. I think introducing an ORM (e.g. sqlalchemy to avoid including Django and stay somewhat slim) would totally work for us, significantly decrease the time to build out MVPs, make our code easier to reason about, and consequently make it easier to maintain our applications in the long-run.
- There are times we needed a cache. The co-worker absolutely refuses to inclide Redis (as a counter-point they have no problem with using elastic search for searching/indexing text) on principle of staying slim. We have historically used Mongo as our primary DB so I wrote a cache decorator to compare Mongo vs. Redis. Mongo is not accurate with TTLs, but more importantly Redis was returning results in a 10th of the time. This, to me, is a case of using the right tool for the job.
- There is background processing we do in several applications. A previous co-worker wrote a distributed cron-runner (avoids running the same job on multiple servers simultaneously) which is not a bad solution. However, these tasks sometimes need to be kicked off when a request is made. I think Celery and Celerybeat is a great tool to fit this job; again, that idea isn't well received.
There are other examples of being given unsolicited feedback on even the most minor design decisions. I can't tell if the co-worker absolutely thinks I am incompetent, if they think on a different wavelength, or if I am missing something important. I've been at this for around 11 years but only 1 with the current company. I am not coming from a perspective of trends or laziness but adapting my previous experience on many, many projects with the needs of my current team. I am open to the idea that co-worker knows many things I don't, but the constant resistance to "everything" is making it very difficult to work with them and run my own projects successfully. I do wish I could understand co-worker's perspective better but I am at a loss.
Anyways, I just wanted to see if anyone else has ran into times where they had to work with someone who was very opinionated, it felt like they were not empowered, and how they handled it. I am asking here, because in the end 90% of our work is writing Python applications.
/r/Python
https://redd.it/7pngyz
I am curious how others have dealt with co-workers who may have had fundamental difference in best practices with co-workers in the past.
Some context:
I have a co-worker (with several years of seniority at this job) who looks at things quite differently than I. While we both agree on KISS, our perspective on what is simple is completely different. We work on primarily "web-applications" but tend to integrate with a lot of external systems.
Some examples:
- The co-worker wants to keep the dependencies as minimal as possible, almost without exception. I agree with not adding complexity needlessly, but am also opposed to reinventing the wheel on the job. Example: limiting ourselves to a document store when the data is very relational in nature. On my end, this adds significant code complexity to perform joins, Cascade deletes, verify relationships are still valid, etc... While data can be structured in a way that makes sense here in some cases, the nesting became too deep for Mongo.
- When dealing with code that would run slower than is acceptable in a single request/response cycle, I would tend to push the logic to Celery, use caching and/or other techniques along those lines. My co-worker does things like spin off a thread from the gunicorn worker or replicates an entire large, external database.
- The co-worker isn't remotely open to the idea of using ORMs on principle. The claim is that you can't optimize if needed (the truth to that statement can be debated) and it adds additional complexity co-worker has to wrap their brain around. However, our applications tend to be small, our deadlines short, and maintainability has been our largest issue historically. I think introducing an ORM (e.g. sqlalchemy to avoid including Django and stay somewhat slim) would totally work for us, significantly decrease the time to build out MVPs, make our code easier to reason about, and consequently make it easier to maintain our applications in the long-run.
- There are times we needed a cache. The co-worker absolutely refuses to inclide Redis (as a counter-point they have no problem with using elastic search for searching/indexing text) on principle of staying slim. We have historically used Mongo as our primary DB so I wrote a cache decorator to compare Mongo vs. Redis. Mongo is not accurate with TTLs, but more importantly Redis was returning results in a 10th of the time. This, to me, is a case of using the right tool for the job.
- There is background processing we do in several applications. A previous co-worker wrote a distributed cron-runner (avoids running the same job on multiple servers simultaneously) which is not a bad solution. However, these tasks sometimes need to be kicked off when a request is made. I think Celery and Celerybeat is a great tool to fit this job; again, that idea isn't well received.
There are other examples of being given unsolicited feedback on even the most minor design decisions. I can't tell if the co-worker absolutely thinks I am incompetent, if they think on a different wavelength, or if I am missing something important. I've been at this for around 11 years but only 1 with the current company. I am not coming from a perspective of trends or laziness but adapting my previous experience on many, many projects with the needs of my current team. I am open to the idea that co-worker knows many things I don't, but the constant resistance to "everything" is making it very difficult to work with them and run my own projects successfully. I do wish I could understand co-worker's perspective better but I am at a loss.
Anyways, I just wanted to see if anyone else has ran into times where they had to work with someone who was very opinionated, it felt like they were not empowered, and how they handled it. I am asking here, because in the end 90% of our work is writing Python applications.
/r/Python
https://redd.it/7pngyz
reddit
Co-Worker & Philosophical Differences • r/Python
I am curious how others have dealt with co-workers who may have had fundamental difference in best practices with co-workers in the past. Some...
Tired of logging to a terminal? I made a GUI for you!
I just released [cutelog](https://github.com/busimus/cutelog), a GUI for Python's standard logging module. It looks [like this](https://i.imgur.com/LQi8ccg.png).
It's cross platform and requires only minimal changes to your code (if you're already using the logging module).
It can do most things you would expect: searching, filtering, multiple connections, customization of the output table, limiting number of records per connection, merging records of several tabs. There's also a [dark theme](https://i.imgur.com/BGUqHM2.png)!
It can also do things you would _not_ expect, because it's in beta and may have bugs. Submit an issue on GitHub if you find one of those!
This is my first released project of any kind, so any feedback is welcome.
/r/Python
https://redd.it/7ppfph
I just released [cutelog](https://github.com/busimus/cutelog), a GUI for Python's standard logging module. It looks [like this](https://i.imgur.com/LQi8ccg.png).
It's cross platform and requires only minimal changes to your code (if you're already using the logging module).
It can do most things you would expect: searching, filtering, multiple connections, customization of the output table, limiting number of records per connection, merging records of several tabs. There's also a [dark theme](https://i.imgur.com/BGUqHM2.png)!
It can also do things you would _not_ expect, because it's in beta and may have bugs. Submit an issue on GitHub if you find one of those!
This is my first released project of any kind, so any feedback is welcome.
/r/Python
https://redd.it/7ppfph
GitHub
GitHub - busimus/cutelog: GUI for logging
GUI for logging. Contribute to busimus/cutelog development by creating an account on GitHub.
Data in object is updated and saved in AJAX, but have to refresh view to see new data.
So, I have an AJAX call on `submit` which takes some data and updates an object and I save that object, where then it will automatically do the POST section in the same view which saves everything and redirects me to a `detail` view which shows me everything pertaining to the whole object. The data I updated is not changed until I refresh the page...but this only happens 50% of the time. It is almost like the `detail` view is occurring before the object saves which doesn't make sense because the redirection is the last line of code before switching to that view.
/r/djangolearning
https://redd.it/7pqt5k
So, I have an AJAX call on `submit` which takes some data and updates an object and I save that object, where then it will automatically do the POST section in the same view which saves everything and redirects me to a `detail` view which shows me everything pertaining to the whole object. The data I updated is not changed until I refresh the page...but this only happens 50% of the time. It is almost like the `detail` view is occurring before the object saves which doesn't make sense because the redirection is the last line of code before switching to that view.
/r/djangolearning
https://redd.it/7pqt5k
reddit
Data in object is updated and saved in AJAX,... • r/djangolearning
So, I have an AJAX call on `submit` which takes some data and updates an object and I save that object, where then it will automatically do the...
A 100% python tutorial on working with smart contracts and decentralized applications
A couple weeks ago I posted https://www.reddit.com/r/Python/comments/7lr48g/a_minitutorial_on_deploying_smart_contracts_with/
At the time I posted the tutorial it was about 50/50 javascript and python. I've updated it to be 100% python.
I tried to make it as minimal as possible so it didn't distract from the lesson on decentralized applications. More importantly I try to keep this repo updated to the most current versions of web3py (python module used to interact with smart contracts) and solidity (the language smart contracts are commonly written in). The smart contract world changes super fast and I'll do my best to keep this current!
Thank you!
/r/Python
https://redd.it/7ppv29
A couple weeks ago I posted https://www.reddit.com/r/Python/comments/7lr48g/a_minitutorial_on_deploying_smart_contracts_with/
At the time I posted the tutorial it was about 50/50 javascript and python. I've updated it to be 100% python.
I tried to make it as minimal as possible so it didn't distract from the lesson on decentralized applications. More importantly I try to keep this repo updated to the most current versions of web3py (python module used to interact with smart contracts) and solidity (the language smart contracts are commonly written in). The smart contract world changes super fast and I'll do my best to keep this current!
Thank you!
/r/Python
https://redd.it/7ppv29
reddit
A mini-tutorial on deploying smart contracts with python • r/Python
I wanted to learn smart contract development for work and started off with a simple tutorial that was in javascript. To challenge myself I started...
My first Twitter bot just made its debut post! I've made a few bots, but this is the one I'm most proud of.
Finished product first:
https://twitter.com/DSCOVRDaily/status/951369376451592192
DSCOVRDaily is a pretty simple bot that takes the images of the earth from [here](https://epic.gsfc.nasa.gov/) and makes a daily GIF. It's been posting for a while to [Imgur](https://imgur.com/user/DSCOVRImagesDaily/submitted), but I thought I'd try playing with Twitter for the first time.
/r/Python
https://redd.it/7pmvku
Finished product first:
https://twitter.com/DSCOVRDaily/status/951369376451592192
DSCOVRDaily is a pretty simple bot that takes the images of the earth from [here](https://epic.gsfc.nasa.gov/) and makes a daily GIF. It's been posting for a while to [Imgur](https://imgur.com/user/DSCOVRImagesDaily/submitted), but I thought I'd try playing with Twitter for the first time.
/r/Python
https://redd.it/7pmvku
Twitter
DSCOVRImagesDaily
Images taken between 2018-01-08 02:01:06 and 2018-01-08 20:01:36 https://t.co/Owainao4Dv
The Square-Sum Problem - Numberphile
[The Square-Sum Problem - Numberphile](https://www.youtube.com/watch?v=G1m7goLCJDY)
*"Given the digits 1..15 arrange them so that all adjacent numbers add to a square number"*
/r/Python
https://redd.it/7prgyg
[The Square-Sum Problem - Numberphile](https://www.youtube.com/watch?v=G1m7goLCJDY)
*"Given the digits 1..15 arrange them so that all adjacent numbers add to a square number"*
/r/Python
https://redd.it/7prgyg
YouTube
The Square-Sum Problem - Numberphile
Matt Parker discusses a problem involving Square Sums. Go deeper with extra footage: https://youtu.be/7_ph5djCCnM
More links & stuff in full description below ↓↓↓
More Matt Parker on Numberphile: http://bit.ly/Matt_Videos
Matt's projects and other stuff:…
More links & stuff in full description below ↓↓↓
More Matt Parker on Numberphile: http://bit.ly/Matt_Videos
Matt's projects and other stuff:…
Home Advantage in Football Leagues Around the World
https://dashee87.github.io/data%20science/python/home-advantage-in-football-leagues-around-the-world/
/r/pystats
https://redd.it/7psjyi
https://dashee87.github.io/data%20science/python/home-advantage-in-football-leagues-around-the-world/
/r/pystats
https://redd.it/7psjyi
dashee87.github.io
Home Advantage in Football Leagues Around the World
This post investigates the universally known but poorly understood home advantage and how it varies in football leagues around the world
How to get friendly Validation Errors
I have the following model and have a nice, friendly validation error message in a custom clean method that works great, it provide a message and a link to follow. However, I also need a custom save method which then causes the validation error to show up as a debug error when I call clean. How would I achieve a friendly validation error here?
FYI: this is an old, old legacy server running django 1.3, python 2.7
class Event(models.Model):
title = models.CharField(max_length=100)
slug = models.CharField(max_length=50, help_text='Automatically built from the title, location and start time.', default="DO NOT EDIT")
location = models.CharField(max_length=50)
event_start_time = models.TimeField()
...
# clean method that will return a friendly error if the slug is not unique and provide a link to list other records with the same slug:
def clean(self, *args, **kwargs):
from django import forms
from django.utils.safestring import mark_safe
while Event.objects.filter(slug=self.slug).exclude(pk=self.pk):
error_message = 'Please double check that your event has not already been entered into the calendar. An event with the exact or very similar title, location and start time already exists.<br /><br /><a href="/admin/events/event/?q=%s">Click here to check existing matching records</a>.' % self.slug
raise forms.ValidationError(mark_safe(error_message))
def save(self):
from django.template.defaultfilters import slugify
self.slug = "%s-%s-%s" % (slugify(self.title)[:39], slugify(self.location), slugify(self.event_start_time)[:4])
self.clean()
return super(Event, self).save()
/r/django
https://redd.it/7psad5
I have the following model and have a nice, friendly validation error message in a custom clean method that works great, it provide a message and a link to follow. However, I also need a custom save method which then causes the validation error to show up as a debug error when I call clean. How would I achieve a friendly validation error here?
FYI: this is an old, old legacy server running django 1.3, python 2.7
class Event(models.Model):
title = models.CharField(max_length=100)
slug = models.CharField(max_length=50, help_text='Automatically built from the title, location and start time.', default="DO NOT EDIT")
location = models.CharField(max_length=50)
event_start_time = models.TimeField()
...
# clean method that will return a friendly error if the slug is not unique and provide a link to list other records with the same slug:
def clean(self, *args, **kwargs):
from django import forms
from django.utils.safestring import mark_safe
while Event.objects.filter(slug=self.slug).exclude(pk=self.pk):
error_message = 'Please double check that your event has not already been entered into the calendar. An event with the exact or very similar title, location and start time already exists.<br /><br /><a href="/admin/events/event/?q=%s">Click here to check existing matching records</a>.' % self.slug
raise forms.ValidationError(mark_safe(error_message))
def save(self):
from django.template.defaultfilters import slugify
self.slug = "%s-%s-%s" % (slugify(self.title)[:39], slugify(self.location), slugify(self.event_start_time)[:4])
self.clean()
return super(Event, self).save()
/r/django
https://redd.it/7psad5
reddit
How to get friendly Validation Errors • r/django
I have the following model and have a nice, friendly validation error message in a custom clean method that works great, it provide a message and...