Anish
How to validate form and print form error in customs form in django
Alex
Alex
Alex
there is a good article about this which even i used for different occasions. i doubt you already tried to properly search answers/examples for your issue or you'd have found it already
Alex
Anish
Alex
Alex
so maybe reconsider some life choices
Anish
Alex
Anish
Alex
Hey he started first.
no i didnt, if you actually followed my advice you'd already have your solution and wouldn't try to fight like a child :)
Anish
I am not fighting bro you started first.
Doragonsureiyā
Hey he started first.
Looks like you need an offtopic group, please continue this conversation at @PythonOfftopic
Alex
Anish
I just started django i searched in documentation but couldn't get a clear idea how to validate custom form.
Anish
After that i posted here.
Martín
Please, for a fight, go private
If you are going to collaborate for a solution, then do it
Alex
Anish
In place of helping beginner you making fun of them. That's not nice.
Martín
I don't know who is the admin, but I would stop fighting and go to him
Or just redirect the whole thing to help each other
Anish
Anish
Leave it ok fine tq for your suggestion.
Alex
Alex
Alex
Leave it ok fine tq for your suggestion.
https://docs.djangoproject.com/en/3.0/ref/forms/fields/#error-messages
you didn't search very well
you were instantly defensive
good luck with your life :)
Derek
you know what? Stop it
Anish
I know that form.errors and message.error ok
Derek
already kiss each other
Derek
and then kiss me
Derek
and I want a hug.
Alex
Derek
This is how we do it in Django community!
Alex
!ot
Doragonsureiyā
Looks like you need an offtopic group, please continue this conversation at @PythonOfftopic
Derek
No with insults but with hugs and kisses... with love..
Anish
If form is not valid
Error will print in form and when i refresh it error message disappear but when i do ctrl+r error message shows again. How to deal with that??
Alex
Anish
Wait a minute.
Rajat
Anish
Rajat
Which one?
Anish
When user successful registered send a link on user's email id when user click on that link user will be logged in.
Anish
Which one?
https://medium.com/@frfahim/django-registration-with-confirmation-email-bb5da011e4ef
Current
Anyone who have watched Corey Mscafer django tutorials?
Current
Damron
Hi everyone!
We can validate data while creating model in two ways:
1) in ModelForm - using clean_fieldname
2) in Model itself
(If there is some another useful method to validate data, pls, tell😅)
So - what is the more widely used way to validate data?
.
SELECT name, STRING_AGG(description, ', ')
FROM test
JOIN ekwdesc ON ekwdesc.value = ANY(test.ekw)
GROUP BY name
Hi, How can I write a query like this using ORM?
Stenly
def validate_date(date, year, month):
if date < datetime.datetime(year=year, month=month, day=1):
raise ValidationError('Date cannot be earlier than year and month')
class Common(models.Model):
MONTH = (
(1, 'January'),
(2, 'February'),
(3, 'March'),
(4, 'April'),
(5, 'May'),
(6, 'June'),
(7, 'July'),
(8, 'August'),
(9, 'September'),
(10, 'October'),
(11, 'November'),
(12, 'December'),
)
month = models.IntegerField(choices=MONTH)
year = models.IntegerField(choices=zip(range(2015, 2021), range(2015, 2021)))
date = models.DateTimeField(validators=[validate_date])
def __str__(self):
return '%s %s' % (self.date, self.month)
class Meta:
abstract = True
unique_together = ('month', 'year')
Stenly
Would you help me with this situation, how to transfer in function "validate_date" parameter "date"?
#
#
#
Checkout again
Shubham
Stuck in a problem
Damron
Hi
I have problem when trying to handle error message when sending post request with fetch JS to django rest, calling serializers.ValidationError, but further fetch doesn't handle this - in console I have an error message:
general.js:26 POST http://127.0.0.1:8000/all/ 400 (Bad Request)
Damron
but with proper data all is fine
PV
I am using sweat alert as js in my django project and i found that there is a python package sweetify for this
PV
But they don't have a well documented style, does anyone used that pavkage
Dev
hello, just want to know steps to change default django admin login template to my own customize html page ...??
Dev
anyone?
Alex
Dev
confusing...
Dev
i just want simple steps
Rohan