i dont know who even has the audacity to dislike this mans videos, these are the most helpful videos with the best way of delivering the information. Hats off to you Net Ninja, you are the best!
Having seen other Django videos it has been very useful to pick up new bits of technique in yours, e.g. templates in the "root" app, Model methods etc. Many thanks
2:24 Small correction. You said putting [:50] will extract the characters from 0 to 50, but actually it will extract from 0 to 49. That's how you'll get the first 50 characters.
{{post.content|slice:":200" }} bro you can use the slice method without the need of creating a new function by the way i like the way you deliver the infos it's so easy and wonderful thank you for everything
I am facing the same issue. class Article(models.Model): body = '' #pylyint : unsubscriptable title = models.CharField(max_length=100) slug = models.SlugField() body = models.TextField() date = models.DateTimeField(auto_now=True) # add in thumbnail later # add author alter def __str__(self): return self.title def snippet(self): return self.body[0:100] + '...'
Hey, i have done the same but instead of getting short line of 50 characters i 've got nothing just name and date this body line is disappeared,please help
many are facing problem that is beacuse of indentation class Article(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=50) body = models.TextField() date = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title def snippet(self): return self.body[:20] + '...' add spaces before def class Article(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=50) body = models.TextField() date = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title def snippet(self): return self.body[:20] + '...'
I have to say the way he teaches is amazing for beginners, very easy to grasp the concepts and follow along. I just hate waiting for the next tutorial (as it comes in drips and drabs)!!
Are Instagram, Pinterest, Disqus, Chaturbate, Bitbucket and etc interesting? You have to start from small and basic things to create something big amigo.
as Shaun said, django is not everyone's favorite so .... just because you're not totally comfortable working with it doesn't mean everyone feels the same as you do
By far some of the best tutorials I've ever seen - you explain everything clearly and concisely. Thank you!!
You can add
{{ article.body|slice:":100" }} {{ '...' }}
in your article_list.html in place of {{ article.body }}
i learnt django about 6 months ago using your videos. i was stuck at model method, cam back to your video and it all made sense instantly.. thanks
i dont know who even has the audacity to dislike this mans videos, these are the most helpful videos with the best way of delivering the information. Hats off to you Net Ninja, you are the best!
Having seen other Django videos it has been very useful to pick up new bits of technique in yours, e.g. templates in the "root" app, Model methods etc. Many thanks
2:24 Small correction. You said putting [:50] will extract the characters from 0 to 50, but actually it will extract from 0 to 49. That's how you'll get the first 50 characters.
I REALLY love this series. I like the short focused segments. Thanks!
Was looking for a simple model method in use and I got one.
This is great!
Thanks for the content.
For anyone having trouble, make sure to use square brackets [:50] and not round brackets () on the slice/truncate
i think the less dislikes show how this content is good is it
Hey Shaun! Love your tutorials. Really hope you will do a series on connecting a django backend to a flutter app
Very nice explaining and best for learning
There is so much functionality in this framework!
Loving this. Looking forward to more.
instead of snippet function we could use {{post.body|truncatewords:30}}
no thanks
I'm better off with the easy thing
@@dustbinsavesyou8283 yes true. Some dude just want to complicate easy things that works!
thanks so much....
{{post.content|slice:":200" }} bro you can use the slice method without the need of creating a new function by the way i like the way you deliver the infos it's so easy and wonderful thank you for everything
Question, is the snippet method you used a part of python or django or was it just a method you arbitrarily made?
amazing approach with your teaching.
Well done and thanks for the video
Can someone explain to me what the point of putting the for loop variable article inside the div class? Thanks much!
I also done this but its not work for me........ any reason?
def snippet(self):
return self.body[:50]
I am facing the same issue.
class Article(models.Model):
body = '' #pylyint : unsubscriptable
title = models.CharField(max_length=100)
slug = models.SlugField()
body = models.TextField()
date = models.DateTimeField(auto_now=True)
# add in thumbnail later
# add author alter
def __str__(self):
return self.title
def snippet(self):
return self.body[0:100] + '...'
Please also check you code indentation
same problem, self.body is unsubscriptable
bro make sure that ur code is in next line n follows the proper indentation
why is there no need to call the snippet function? Is it just how template tags work?
What is the name of your Atom font Shaun?
3:32 amen brother
Why can we leave out the brackets while calling this method? Thought @property would do this.
Hi, i have a quest. When you create a new article by admin page, where does it store??
in your db.sqlite3
I added the … string without even looking at the video, it came naturally.
Same here :D
Why not need to call shippet function ?
amazing video, thanks a lot,
Is it possible to make a tutorial about GraphQL in the future? I think it's really interesting
Thanks :). GraphQL is definitely on the radar for before the end of this year :)
Hey, i have done the same but instead of getting short line of 50 characters i 've got nothing just name and date this body line is disappeared,please help
Same here , dunno why
not working for me..
many are facing problem that is beacuse of indentation
class Article(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=50)
body = models.TextField()
date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
def snippet(self):
return self.body[:20] + '...'
add spaces before def
class Article(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=50)
body = models.TextField()
date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
def snippet(self):
return self.body[:20] + '...'
truncatechars=120
thx
Hi Shaun, sorry to say, this Django not that much interesting
Hey it's ok. Django is not everyone's favourite, but a lot of people do like it as well.
I have to say the way he teaches is amazing for beginners, very easy to grasp the concepts and follow along. I just hate waiting for the next tutorial (as it comes in drips and drabs)!!
Are Instagram, Pinterest, Disqus, Chaturbate, Bitbucket and etc interesting? You have to start from small and basic things to create something big amigo.
as Shaun said, django is not everyone's favorite so .... just because you're not totally comfortable working with it doesn't mean everyone feels the same as you do