V
Anybody please
V
Tell how to do it through windows
Mirco
Tell how to do it through windows
open Django docs and follow the instructions please
Mojtaba Arezoomand
Hi How can I control anonymous user?
If request.user.is_authenticated == False
Mojtaba Arezoomand
Hpw do I validate passwords set on django in react native or any other framework.
If ur using drf for the apis your password validation is def validate_password(self, value): if not re.match("^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$", value): raise serializers.ValidationError("your message") return value
Hamouda
when i alter my database and makemigrations AND migrate, there will be a new file in the folder of migrations
Hamouda
is it the best practise or should i take the changes to the first file 0001_initial.py ?
Mojtaba Arezoomand
Can anybody tell about this please?
If u wanna install virtualenv just in windows pip install virtualenv Then virtualenv venv (or anyname u want) Now if u r in git console source venv/Scripts/activate If ur wundows console: venv\Scripts\activate
Anonymous
In Django how I make one user that users can create new user
Mojtaba Arezoomand
In Django how I make one user that users can create new user
What do you mean If u mean admin user py manage.py createsuperuser
Anonymous
I mean in hospital receptionist can create a new patient and new doctor users like this
Mojtaba Arezoomand
I mean in hospital receptionist can create a new patient and new doctor users like this
You should add role to your user account Actually u can extend the user model And u can have roles like receptionist or admin or doctor or patient And create a customized admin panel for them This is what ppl usually do
Anonymous
Thanks for your help but I am new on Django or web development So it's so hard for me But I can learn from Google or YouTube but I want to know what methods we called to this future or function
lychnobite
How I can create in form fields height width and background
pankaj
Hi guys , getting difficulty to retrieve the multiple table data from database. Using Froigenkey
Mojtaba Arezoomand
Ya what we call this method?
You should import Django User Model and extend fields to it https://stackoverflow.com/questions/21779226/abstractuser-django-full-example You should import Abstractuser And give it to User model u create in models.py And add a code to settings.py its shown in link
Anonymous
Okay
Mojtaba Arezoomand
Create accounts app and do these stuff in this app
If u create account app this will be ur code in settings.py AUTH_USER_MODEL = "accounts.User" AUTH_USER_MODEL = "<app_name>.<Model_name>"
Anonymous
Okay
Viсtor
Hello to all, maybe somebody know how to execute a function every i seconds without stoping a server?
lychnobite
I created the form. How do change the height, width and background of the form fields in html
Mojtaba Arezoomand
I created the form. How do change the height, width and background of the form fields in html
Search how to add extra class to django form fields There are several answers Do it then give ur styles to the class
Mojtaba Arezoomand
Thanks .for help😊
def init(self, *args, kwargs): super(FormName, self).__init__(*args, kwargs) self.fields['field_name'].widget.attrs['class'] = 'class_name' I think this should work Add this to ur Form Class
Mojtaba Arezoomand
Check in the inspect and see if class is added
Evgeniy
How to implement setter for Content Type for edit?
DK
How can I do django website ssl settings. Now its opening in http. I want to redirect in https. Can anyone help me.
Hasan
If request.user.is_authenticated == False
I want to user can like and dislike posts I have manyTomany field to User model and add user into this filed But i got an error that you cant add anonymous user I want sulotion for this
Anonymous
so much easier
Hasan
so much easier
Please explain me
Thedrowsywinger
I was wondering if anyone could help me out with this problem. I can't figure out how to send emails using django, which would be an html template, with images. I managed to send html templates , where the css is also working, but can't make the images work. Could anyone please help me out? Thank you!
G
How can I do django website ssl settings. Now its opening in http. I want to redirect in https. Can anyone help me.
You have to first get Https certificate for your domain. Configure Apache,ngnix etc to serve Https
G
I created the form. How do change the height, width and background of the form fields in html
Depends how you are doing. If using Twitter bootstrap, you can add attr widget class in form. Else. You have to create div, class, CSS the way you want and put form variables at appropriate place
G
You can add attr widget even without bootstrap
G
Installtion guides for Django in Windows and creating virtual environment
Try anaconda/conda. That will be simple and easier in begining
RKumar
How to show all three tables data in a single table in django
k
I want to implement facebook and instagram login from my django site..how to get started?
Damilola
Hello everyone, I want to write a unit test for django rest framework multiple file upload. Any ideas please?
Damilola
I want to implement facebook and instagram login from my django site..how to get started?
Use django all auth. It allows laugh integration with simplicity
Nirupam
Guys,can we write periodic task without celery ??
Zey
Hii, anyone know to create an extra field in User model?
Zey
Hii, anyone know to create an extra field in User model?
Like I want an mobile field ,how I can do that ?
First name (optional)
I'm getting NonExistentTimeError from yesterday, what is this error? How can I solve it ? 🤦‍♂ on 2021-03-22 00:00:00
Alina
Hey. I am new in python. I am trying to build blog post website and should add two char fields for address and phone number in the BlogPost form When i add them in my model it gives me error in browser. How can i solve it?
Mojtaba Arezoomand
I want to user can like and dislike posts I have manyTomany field to User model and add user into this filed But i got an error that you cant add anonymous user I want sulotion for this
U should add LoginRequiredMixin or login required decorator if u r using fucntions OR Before u add user the like table check if request.user.is_authenticated: then add user to the like model Else Print("Login to like posts")
Mojtaba Arezoomand
You should import Django User Model and extend fields to it https://stackoverflow.com/questions/21779226/abstractuser-django-full-example You should import Abstractuser And give it to User model u create in models.py And add a code to settings.py its shown in link AUTH_USER_MODEL="<app_name>.<Model_name
Mojtaba Arezoomand
Check out the link
Zey
Check out the link
Thanks I will try
Mojtaba Arezoomand
Alina
Hey. I am new in python. I am trying to build blog post website and should add two char fields for address and phone number in the BlogPost form When i add them in my model it gives me error in browser. How can i solve it?
Alina
Solved it👍
Dev
Hi , currently using a package called django_tenants to handle my multi-tenancy arch. and it works well but i'm moving to production and would want to limit access with the ALLOWED_HOSTS key in settings. How do i manage to make sure that it can handle all subdomains coming from example.com eg. ama.example.com , kofi.example.com thanks
John Carter
Where to learn django from begineer to advanced in one week ??
Anonymous
Where to learn django from begineer to advanced in one week ??
On udemy, find Nick walter course, but before that make sure you are comfortable with python.
~:$
Cache for django project Memcache VS Redis Cache???? Professional Advice please. Thank you.
Dev
yeah but i want it to handle subdomains
Dev
'.example.com' doesn't cater for wildcards
~~~
what all files need to ignore and how to secure django project before push to git
Mojtaba Arezoomand
what all files need to ignore and how to secure django project before push to git
Settings.py is one of them because of your secret code and your database information and ... Anyway it is not safe to do important information in settings.py https://simpleisbetterthancomplex.com/2015/11/26/package-of-the-week-python-decouple.html Check out this link it will help you out
Евгений
Guys can u help me pls I'm parsing website https://news.ycombinator.com/news I need a list of points for each news I have this code https://del.dog/exirestign output of this code has list of points and if news doesn't have points: <a href="item?id=26541390">14 minutes ago</a> Can u help how instead this write ' - '
Charanjit Singh
P.
Hello everyone. I need to implement a page where my logged users will be able to browse/create folders/download/upload a set of files uploaded by them. I'm searching for an easy and stable product that I can plug into my django web server. Any advices ?
fareen_a
what all files need to ignore and how to secure django project before push to git
You can use gitignore before pushing ur code to git or heroku You can add files like log , pycache files etc on gitignore