Maksim
Or first_name
Денис
Not the best way, I think. Slug is a slug on purpose, it was invented for online newspapers and serves for creating unique URLs. So you should have separate first_name and slug fields. Read about SlugField in the docs
The Summer
Денис
I don't care what is slug I just want to use str as not integer
then you probably need any string field with unique=true. And remember that spaces can be used in names, which can't be used in URLs and are "slugified" (replaced by hyphens) in slug fields.
I can't help you now because I lack time for this. Read Django By Examle, there's a good example of slugs in their best form of usage.
The Summer
Ram
How do i get the current user's username in django
Ram
How do i upload image to the folder which is named after the current user
Example:-
If user XYZ uploads the image,then i want the image to be uploaded to his folder(named XYZ)
Mirco
Ram
Ya i what should be argument of upload_to?
Ram
I want image to get uploaded at different files not same
Mirco
Read it
Ram
I used instance.username
Mirco
Ram
Explain better
If i upload a image it should go to folder named "Ram"
If you upload a image it should go to folder named "micro"
Ram
So that each and every user will have the folder named after him.
Which will contain images uploaded by just him/her
Mirco
Anonymous
How to user email authentication in django?
Mirco
If u pass a method to upload_to and create a folder with instance.username ( if it's unique ), it will work
Anonymous
Mirco
Any example?
Google it 😁 it's plenty of it out there
Ram
Mirco
That technique works 😊
Ram
Anonymous
How go show products in home page from models like amazon
Ram
That technique works 😊
Tell me one thing
Do i need to make a folder before running the project
Or will it automatically create a folder
Mirco
Mirco
Mirco
https://docs.djangoproject.com/en/2.2/howto/static-files/
Mirco
S
I used to do this when I am dealing with S3 bucket.
Ram
2 folder was just an example
Pedro
do anybody have a good tutorial of django ...? i get this one
https://www.youtube.com/watch?v=F5mRW0jo-U4
Pedro
excelent... thanks
Anonymous
Anyone here knows how do I download unity on Ubuntu
🧩
Guys, when go to http://127.0.0.1:8001/admin/ get this
🧩
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8001/admin/
Raised by: news.views.PageViews
🧩
class PageViews(ListView):
template_name = 'page.html'
paginate_by = 8
context_object_name = 'posts'
ordering = ['-datetime']
model = Page
paginate_orphans = 1
def dispatch(self, request, *args, **kwargs):
slug = kwargs.get('slug')
try:
self.category = Category.objects.get(slug=slug)
except Category.DoesNotExist:
raise Http404
return super().dispatch(request, *args, **kwargs)
def get_queryset(self):
return Page.objects.filter(category=self.category)
🧩
What problme?
Ghorz
I m developing a Ecommerce Book selling web app using django. I m facing a problem,
I tried to make the payment method same as Amazon (only for demo) so when i buy product , I enter the name , and details of user and also card details for payments and vice versa, lets say two users buy different product but when i go and check my orders page , it shows my product with my payment details and and also his product with my payment details and his name and payment details with my product and hia product.
I m not able to solve this
You got a long way to go man!
The mistake early developers make is rushing into developing complex systems.
My advice, learn Django properly, follow a few tutorials and complete them.
Start pet project, like book library, photo gallery, portfolio systems.
After that, you can start diving deep.
I created a shop system with live payments gateway called paystack, the paystack plugin was dev by me.
It was a hell of a journey but interesting. You will process payment, get status, update shopping status, generate receipts,.....
https://ghorz.com/shop/
Good luck
Ghorz
Ghorz
For Beginners, django girls is your best bet.
Dextroleav
You got a long way to go man!
The mistake early developers make is rushing into developing complex systems.
My advice, learn Django properly, follow a few tutorials and complete them.
Start pet project, like book library, photo gallery, portfolio systems.
After that, you can start diving deep.
I created a shop system with live payments gateway called paystack, the paystack plugin was dev by me.
It was a hell of a journey but interesting. You will process payment, get status, update shopping status, generate receipts,.....
https://ghorz.com/shop/
Good luck
Well my one doesn't has that much complexity, my whole project is complete except that part.
The Summer
Guys I have a problem I want to sent books objects of current page's author not all author's books
So plz see and tell me how I can do it
Here is pastebin
https://pastebin.com/EjvZEiyR
Anonymous
The Summer
Can u write
The Summer
I tried but got some errors
Anonymous
Can u write
https://docs.djangoproject.com/en/2.2/topics/db/queries/
The Summer
See I get specific when I manually write
Book.objects.filter(author=1)
The Summer
how to write variable instead of that 1
That 1 should be id of current page(author/1)
Anonymous
Book.objects.filter(author=user.id)
The Summer
I tried this too
The Summer
I get int() argument must be a string, a bytes-like object or a number, not 'DeferredAttribue'
Anonymous
Go through www.nseindia.com and derive the following data about the input stock-list (
mentioned at the end).
Data required: Open, High, Low, Close, Volume, Delivery Data, Delivery Percentage
Input stock-list: RELIANCE, HDFCBANK, ADANIPORTS, ITC, SBI, IOC, RBLBANK, SBI
Use necessary libraries to present the data obtained in a user-readable format.
The code must include one function which takes the stock as input and return the data required
in the user-readable format
Anonymous
any one please answer this
The Summer
Anonymous
..
change user.id to author.id
The Summer
Yeah I did that I don't have user model so
The Summer
Anonymous
I will need to see your models file. Too lazy to think properly at the moment
Anonymous
dm
The Summer
Tony
Whenever you give a view an argument apart from request you have to add that argument to the URL of that view.
I want to know if there is a way I can avoid that.
Rafael
Dear guys !
Which frontend are you using ?
Thank you .
cj
Rafael
thank you
Anonymous
angular8
Rajab
Vachagan Muradyan
How to add multiply images to one model in django?
Vachagan Muradyan
I don't want to add multiply imagefield
cj
add an ArrayField of ImageField