Anonymous
I am running a test but it's giving me an error even though. Everything looks fine
Anonymous
<input name="email" class="form-control" required="" id="id_email" type="email">
Anonymous
this what I am trying to assert in response
Anonymous
I am using assertContains with html=True
Anonymous
okay, found the problem
Anonymous
The problem was
required=""
Anonymous
It should be
required
only
Django Bot
>> Blogs
- The Simple Power of Django Validators
Abhi
anyone has used rsync ?
8la
Who doesnt?
8la
😁
8la
Rsync is swiss army knife for sync and copying files xD
Abhi
i want to use it my django project
Abhi
after synchronising the files, does it return something that operation has completed ?
8la
ummm
8la
i dont get your point
8la
when you invoke it from the shell
8la
it retunrs 0 if everything goes ok
Django Bot
>> Blogs
- How to Create a Custom Django User Model
Django Bot
>> Blogs
- A Complete Beginner's Guide to Django - Part 6
Anonymous
Anonymous
inchidi
if you like discount, now two scoops of django offer misprint version
https://www.twoscoopspress.com/products/two-scoops-of-django-1-11#misprints
Ghazwan
https://www.youtube.com/watch?v=5y7vU52jOiQ
Ghazwan
great talk.
Anonymous
Anonymous
But library Django
Use in tutorial
Ghazwan
what library ?
Anonymous
Ba seUserManager, AbstractBaseUser
👆🏻
Anonymous
BaseUserManager, AbstractBaseUser
Existing in any version
Ghazwan
they are in django 1.11 too
Ghazwan
it really does not matter as long as you use django 1.8+
Ghazwan
and the guy in that article does.
Anonymous
Thanks bro ❤️
Ghazwan
btw
Ghazwan
consider this coupon udemy django course
Ghazwan
http://www.awin1.com/cread.php?awinmid=6554&awinaffid=313099&clickref=&p=https://www.udemy.com/django-core/?couponCode=CFENOV2016
Ghazwan
django core reference
Ghazwan
it's great for understanding what django does in the background for u, i leant a lot.
Anonymous
Yes it’s very nice 👍🏻
I see tutorial now
Thank you again
Ghazwan
Welcome
Anonymous
can someone explain wat the heck select related is, official doc is not detailed enough abt it
Anonymous
😑
inchidi
Anonymous
Anonymous
inchidi
inchidi
select them only by related name for the forign keys is how relationship work
inchidi
select related is how the sql query produced
Anonymous
Anonymous
thanks
Lapanit ☃️
Lapanit ☃️
Anonymous
Anonymous
bub
bəb
nounNORTH AMERICANinformal
an aggressive or rude way of addressing a boy or man.
Lapanit ☃️
Anonymous
Anonymous
https://www.google.com/search?q=bub&oq=bub&aqs=chrome.0.69i59j69i60l2j69i57j69i61j69i60.826j0j1&sourceid=chrome&ie=UTF-8
Lapanit ☃️
Oh my if its in the internet...it should be true! Good work bub, and nice detail with wrong kiddo…
Lapanit ☃️
bub its a short for Bubba, just fyi
Anonymous
okay even if you mean smth bad, i pardon u as my mom taught me before
inchidi
oh yeah
i will try to give better explanation about select_related(). so i have 2 models like this:
class BlogModel(models.Model):
name = models.CharField(max_length=32)
class ArticleModel(models.Model):
blog = models.ForeignKey(BlogModel)
title = models.CharField(max_length=52)
inchidi
when you do article = ArticleModel.objects.get(id=1) the sql query looks like
SELECT "django_example_articlemodel"."id", "django_example_articlemodel"."blog_id", "django_example_articlemodel"."title" FROM "django_example_articlemodel" WHERE "django_example_articlemodel"."id" = 1;
so you got 3 data which is article.id, article.blog_id, article.title. all data is article data, when you do article.blog then it will create new transaction to database
inchidi
but if you use select related():
ArticleModel.objects.select_related('blog').get(id=1)
the sql query looks like:
SELECT "django_example_articlemodel"."id", "django_example_articlemodel"."blog_id", "django_example_articlemodel"."title", "django_example_blogmodel"."id", "django_example_blogmodel"."name" FROM "django_example_articlemodel" INNER JOIN "django_example_blogmodel" ON ("django_example_articlemodel"."blog_id" = "django_example_blogmodel"."id") WHERE "django_example_articlemodel"."id" = 1;
so you got 5 data, 3 just like without select_related and 2 is blogmodel data's
inchidi
when work with complex db relationship, select_related really usefull to make database transaction as min as possible
inchidi
you can also use prefetch_related(), its like select_realted but in "invert mode"
BlogModel.objects.prefetch_related('articlemodel_set').get(id=1)
it will use/produce 2 sql queries, first one select from blog, and second one select from article
Anonymous
that was pretty clear
Anonymous
thanks @DimasInchidi
inchidi
noice okay
Ghazwan
I surrender inchidi
Ghazwan
functional programming is easier than OOP in django.
Ghazwan
i am depressed by the number of self i forget to write everyday for everything :(
inchidi
Django Bot
>> Blogs
- Disabling Error Emails in Django