Tridip
Hello guys, does anyone know how to create multiple user types in Django?? Suppose in an online doctor consultation app, I have two types of users for registering and login --- Doctors and patients. Can anyone help me with it?? Please.
Thank You in advance
Tridip
Mohammadreza
Bunty chhatri wala..
Anonymous
in django rest framework mixins for createmodelmixin what is the request method? and what about for others
Tridip
Tridip
Anonymous
in django rest framework mixins for createmodelmixin what is the request method? and what about for others
the method for retrieve and create view mixin create some confusion here
pythonista
I have seen a django security video that says "the django python code should be outside of the servers root. So that the python code is not accidentaly served as plain text." I have tried to access but I cant get the python as plain text. Or I am missing something. I want to fix this security problem and want to know about about this. Is this really a problem or not?
aleks-th
pythonista
What do you mean ?
"the django python code should be outside of the servers root. So that the python code is not accidentaly served as plain text."
Is this true?
Jesus
how's called the programming technique(or design pattern) that django uses for the admin page? for example, having the admin page and loading it up with some models from each admin.p admin.site.register()
D
Which works best with django ?nginx or apache
cj
D
What makes nginx better tan apache for Django
Gaurav
Hello, I am having some problems while implenting BaseDeleteView class. Error message says, object has no attribute render_to_response. Have a look to traceback->
pastebin.com/VeEELWZb
SmQ
Maz
Tzipi
If this is the class definition:
class Table1 (models.Model)
pk=id
class Table2 (models.Model)
pk=id
table1= FK table1
class Table3 (models.Model)
feild1 = FK Table1
feild2 = FK Table2
num= int
class Meta:
unique_together =(“field1”,”feild2”)
I want that class table2 will be created with a known table 1 pk.
Many of table 2 to many of table 1, but for each record in table 2there is one and only 1 record in table 1.
Table3 contain 2 FK to table1 and table2 and extra field.
1. Is table1 field is a m2m field or FK field?
2. I want to have option to add in Table3 many instances of {table1:table2}. In this implementation I am restricted, I think it because of unique constraint.
3. How I use the utility of : unique_together- in Table3 and through ? Do I have to have m2m?
Generalmax
Hello everyone! How do I render an image from the ImageField to HTML screen? I have created the model, and I have been able to upload from the admin page into my media fold. It returns error when rendering.i have set the MEDIA_ROOT and MEDIA_URL. I used the conventional rendering to render the input image, it returns error.
I have also added the the static stuff to the URLPATTERNS
Украинский
M.T.saeedi
Hi i install oauth2 in my application but not found in app install
M.T.saeedi
How can solve it?
pythonista
Why django gives error when i repeatedly press a button. How to prevent this?
a lee
hey im trying to create a pastebin clone i have some problems for self destructs
here is my code for removing pastes after 1 minute
class PasteCreate(CreateView):
model = Paste
fields = ['text', 'name', 'destroy']
def delete_old(self):
now = datetime.datetime.now()
ago = now - datetime.timedelta(minutes=1)
old_pastes = Paste.objects.filter(created_on__lte=ago)
if Paste.destroy == "True":
old_pastes.delete()
and its not working but i created a sub command with same code and set the time to 1 hour it works but it remove every post in db even the one i created 1 min ago any help or suggestions?
@l3j@ndr0
Hello I am new in django. This html tag syntax it is ok??
<img src="{% static 'images/img.jpg'%}>
cj
@l3j@ndr0
Doragonsureiyā
The image does not show and exists in the image dir
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase
@l3j@ndr0
Artyom
https://stackoverflow.com/questions/64304975/resize-uploaded-images-does-not-work-correctly-django
Who can watch? Tell me how to make it work, my brain is already dead
B_Ayush
Guys...I am unable to sort out the error
I am trying to get image from static folder and it is giving error
Have a look on my code and directory
B_Ayush
<img
href="{ % static 'templates\static\slide1.jfif' % }"
class="d-block w-100"
alt="..."
/>
Tridip
Hello guys,
Needed one help.
How to use Postman without using Django rest?? Please help. It's urgent
Thank You in advance
Jz
Alex
hi, I am making a website and thinking of using django, but I am not sure weather it can handle asynchronous requests or nor..I searched on internet but didn't found any satisfying answers
Alex
help is appreciated
A
I'm trying to login using folowing code but even though I have already registered user with password this code is not working.always getting Invalid name/password.what's wrong in code ? data = JSONParser().parse(request)
name = data.get('name', None)
password = data.get('password', None)
if not name or not password:
return Response({'ERROR': 'Please provide both username and password'},
status=status.HTTP_400_BAD_REQUEST)
if authenticate(username=name, password=password):
user = User.objects.get(username=name)
else:
return Response({'Error': 'Invalid name/Password'}, status=status.HTTP_400_BAD_REQUEST)
cj
A
Doragonsureiyā
To share code or error tracebacks please use an online pasting service, here is a list of suggested sites:
- https://del.dog
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
B_Ayush
you have to set static folders in settings.py
I couldn't get the solution as .py file is language specific and static is folder here.
If you are saying to keep the static folder and setiings.py file in same directory then I tried but couldn't even get result
Darth✧
Darth✧
https://dpaste.org/eWOD
I m getting stuck while saving a file in model ...please have a look..any solutions how to do it ?
M
hi How many clients i can serve with just running manag.py runserver in Django .. i just read that people use ngnix and gunicorn for better experience
M
my project is small and mostly 6-10 users will login at a time.. will it survive without ngnix ?
Darth✧
Rohan
Darth✧
What do u mean by " without using django rest?
Rohan
Rohan
Or you can use the django test suite which is easier and better.
Darth✧
Darth✧
Rohan
Darth✧
Rohan
Rohan
Just why?
Darth✧
From view itself
Rohan
You have a database.
Darth✧
Just why?
I wanna use that processed data in other view or let say templ
Rohan
Even better, use a jsonfield and trasnform dataframe to a dictionary
Rohan
Rohan
Like column by column and not csv as whole
Rohan
Rohan
If your data is huge, what you can do is store it on cloud and save a link of the uploaded data
Rohan
Like if you're using AWS. You can use S3.
Darth✧
Wait.... No
Thats why ...I want to convert it into CSv or any another format and save it as a file
Rohan
But it depends a lot on your usecase
Rohan
Would you frequently need that data?
Darth✧
Darth✧
Can u discuss in private ?
Rohan
Yup
Do you have to perform ops on that data? Like filters?
Rohan
Rohan
So we can have more input from others as well