Kuth
Consider on the line
context = {
foo = bar
...
}
return render(request, template_name, context)
Kuth
def example_one (request):
{Your code }
return render (request, 'index.html', ...)
def example_two(request):
return render (request, 'index. html', ...)
Kuth
This case the same index.html but can render dynamic content base on your implemented same template variable but different function
So client can request from different route to same but render just a single page
Doragonsureiyā
I have a 3 models
Product
User
Basket
I've sent a product to Basket , but the content of product isnt showing in the basket, it looks like:
[
{
"id": 1,
"user": {
"id": 1,
"password": "islomjon2007",
"login": "islomzhonsheraliev",
"name": "Islomjon Sheraliyev",
"role": "admin"
},
"products": [ ]
}
]
here's the product api:
[
{
"id": 1,
"title": "Shuxrat",
"brand": "Shuxrat shinalari",
"description": "Shuxrat shinalari nomer 1",
"image": "http://127.0.0.1:8000/media/images/download_1_raenEd1.png",
"price": "500.00",
"size": "XXL",
"currency": "USD"
},
{
"id": 2,
"title": "trnyjryj",
"brand": "ertyerj",
"description": "rtshjrsh",
"image": "http://127.0.0.1:8000/media/images/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA_%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0_12.png",
"price": "5000000.00",
"size": "3xxxl",
"currency": "UZS"
}
]
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
_VVV_
Please help me connect ms sql server, where is the error?
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'calculation', # Имя вашей базы данных MS SQL Server
'HOST': 'LAPTOP-I338VDBM\\SQLEXPRESS', # Имя сервера MS SQL Server
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server', # Драйвер ODBC для SQL Server
'trusted_connection': 'yes', # Использовать Windows Authentication
},
},
}
The Inspired
Charly
Kevelino
Please anyone can help me with easy panel, to deploy Django application?
Kevelino
https://cfptac.com go to this site to see the response from easypanel deployment.
Chintu
{ "user": {
"username": "reseller_username", "email": "reseller@example.com",
"password": "your_password", "mobile": "9876543210"
}, "company_name": "Company ABC",
"cin_no": "CIN1234567", "company_address": "123 Street, City",
"pan_card_number": "ABCDE1234F", "bank_name": "Bank of Reseller",
"bank_account_number": "1234567890", "ifsc_code": "ABCD0123456",
"region_state": "State ABC", "pincode": 123456,
"select_category": "ESIM", "salesman": 1
} how can test this api in postman but i am facing this issue because i have the these fields....in user model have the json type data but if i want to file upload then it will form-data so how can i handle this in one api
Chintu
anyone know the solution then please let me know
nizzer
i need help when i try to use phonenumberfieldwidget in my form.py i did get the country code for my phone number class OnlineMember(models.Model):
MALE = 'M'
FEMALE = 'F'
OTHER = 'O'
NOT_SPECIFIED = 'N'
GENGER_CHOICES = [
(MALE, 'Male'),
(FEMALE, 'Female'),
(OTHER, 'Other'),
(NOT_SPECIFIED, 'Not Specified'),
]
first_name=models.CharField(max_length=100)
last_name=models.CharField(max_length=100)
email=models.EmailField()
phone_number=PhoneNumberField()
gender=models.CharField(max_length=10,choices=GENGER_CHOICES,default='NOT_SPECIFIED')
country=CountryField(blank_label='(select country)')
Doragonsureiyā
i need help when i try to use phonenumberfieldwidget in my form.py i did get the country code for my phone number class OnlineMember(models.Model):
MALE = 'M'
FEMALE = 'F'
OTHER = 'O'
NOT_SPECIFIED = 'N'
GENGER_CHOICES = [
(MALE, 'Male'),
(FEMALE, 'Female'),
(OTHER, 'Other'),
(NOT_SPECIFIED, 'Not Specified'),
]
first_name=models.CharField(max_length=100)
last_name=models.CharField(max_length=100)
email=models.EmailField()
phone_number=PhoneNumberField()
gender=models.CharField(max_length=10,choices=GENGER_CHOICES,default='NOT_SPECIFIED')
country=CountryField(blank_label='(select country)')
No one can help you until you explain your difficulties.
nizzer
i got this '
MultiWidget.init() got an unexpected keyword argument 'input_attrs''
Baliraine
how can i make time setting to east african time when my django project is live at pythonanywhere
Priyanshu Pratap
Hey anyone knows how to use django template language inside javascript...like i want to use for loop of DTL like {% for data in dataset %} ... and some other dtl after that... anyone know how to do that?
Maxim
Priyanshu Pratap
impossible
that's server-side party
So how i can do that like i am sending json data from my views.py to html file where JavaScript code is also there and inside the js there is a function where i have to use the value provided by that json data
Priyanshu Pratap
Okay 👍🏻
Parsa
Hi guys 👋 is the Django models can connect to the all database with createing models for example if i create models in Django it is create database like SQLite or postgress for can it work for mongo or Graph database?
Charly
Maria
Hi all..
I am having a django application that reads and writes in to a network path that's looks like \\10.0.12.104
But I'm not able to read or write into it through my APIs..
But I'm able to read and write for this path from django shell.
This works in my local host.
But when I'm deploying it I'm getting the network error..
Please advise
Nick
how to get connections details from mysql db?
Mirco
Nick
Mirco
Already
Ask ChatGPT 😁
Jokes apart, what do you need exactly ?
Nick
Mirco
Nick
Charly
Apache
That wasn't the question
01110010
Connect with ur host address and port
xv
how can i use is https://github.com/citusdata/django-multitenant to create schemas, anyone used this before😀😀😀
Lauriano
Hi class
My question is about foreign key.
I have two tables, the first table is named <plant>
and the second table is <photo>.
The table <foto> has a foreign key to the table <plant>,
- because the relationship in question is many photos for a single plant, how do I access the value (name) of the plant, using the <photo> table?
I am studying this document:
https://docs.djangoproject.com/en/5.0/ref/models/querysets/#id4
01110010
Priyanshu Pratap
impossible
that's server-side party
I did it...i had to use my variable as {{pythonvar|safe}} actually when we pass python variable to html using DTL then special character gets html hex encoded so by using 'safe' it skip or prevent our variable from encoding
01110010
Lauriano
Siddharth
hello sir please allowthe file sending option
Siddharth
i have suffering a template problem
Doragonsureiyā
Abdullo
Данuло
Hello,
could somebody tell me if it’s normal to delete all the migrations and initialise new one, before posting on platforms like GitHub, or should i leave them as they are and why?
Abror
Hello community
How can I represent month as a field in django models
Circuit
mates! what causes this error in replit django projects [26/Jun/2024 11:05:03] "GET / HTTP/1.1" 200 290
[26/Jun/2024 11:05:30] "GET /admin/ HTTP/1.1" 302 0
[26/Jun/2024 11:05:30] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 4158
Forbidden (CSRF cookie not set.): /admin/login/
jager
hello, does anyone have a login and registration template for the website?
Charly
Charly
Circuit
Asr
Anyone using pythonanywhere?
I am creating a project in django and make it live on pythonanywhere.
I am facing a problem I try to upload a file which size is 500mb and it's show entity is too large anyone know what is the solution?
Vikend 🏆
Abhi
Abhi
Siddharth
Asr
Okay i'll try it
Abhi
Freak🙃
I'm working on user registration,login using Custom user, I'm really facing it hard,anyone please
Charly
Nichervan
What is the best module to add country lists and phone codes in Django models guys can you give me an example I want to use this to field for register form
M
Is Django recommended for beginners to learn backend dev? I am good in python language.
Doragonsureiyā
Harshith
does django have future
Rupesh
Anyone here who work in product based company and use django?
Rupesh
I think django has no future for good career growth
Suryo Adhy Chandra
ㅤ
Genaro
Hi, has anyone ever make a deploy of a Django app using docker in a cloud server?
Charly