Mirco
field2 is itself a select field
ok but where do you have thousands of entries ?
Neo
field2 is the seperate model having entries
Neo
field2 get all the entries from that model
Mirco
field2 get all the entries from that model
and does that model have fk ? and u can install django debug tool to inspect how many queryiesyour view makes
Mirco
yes it have fk
ok, so this one can be useful for u to understand how select_related could speed up your queries when django has relationships
Neo
let me see
Mirco
let me see
😃
Neo
but If you are right where can i use select_related
Neo
as I only used it in quesyset
Neo
not in fields
Mirco
not in fields
but your field2 makes a query so it calls get_queryset of that model
Neo
you mean I can do something like def get_queryset(): super(something) mynewqueryset here
Doragonsureiyā
you mean I can do something like def get_queryset(): super(something) mynewqueryset here
Please format the code you posted, by wrapping it in triple backticks. -> `
Mirco
ok, so this one can be useful for u to understand how select_related could speed up your queries when django has relationships
this one explains so good what you can do instead of "County" , use the model your field2 has to query to get all entries for the select field
Neo
ok thanksI will read it fully
Mirco
S.
hi friends I wanna send e mails periodicly. And my model has start date- end date-cronExpression for example startdate=04.04.2019 enddate=05.05.2019 cronExpression= 0 10 * * 1 (“At 10:00 on Monday.”) how can I make this I dont know? Should I use Celery or CronTab? I dont know. Can you explain?
S.
thank youuu
Mirco
thank youuu
Yw 😊
highnes
I have a model userprofile with one to one relation with user model, how can i acess data of logged in user from userprofile model
highnes
Can someone help, please
Doragonsureiyā
Please format the code you posted, by wrapping it in triple backticks. -> `
highnes
class UserProfile(models.Model): models.OneToOneField(User,on_delete=models.CASCADE) mob_no = models.CharField(max_length=10,blank=False,default=None) house_no = models.CharField(max_length=80,blank=False,default=None) street = models.CharField(max_length=80,blank=False,default=None) district = models.CharField(max_length=80,blank=False,default=None) state = models.CharField(max_length=80,blank=False,default=None) pin = models.CharField(max_length=9,blank=False,default=None)
inchidi
then you can access user profile from user.profile
highnes
Thankyou @Inchidi
Anonymous
hello
Anonymous
Hello everyone i cant work is_valid() function in djangk when i loaded page is_valid() function auto working also clean methods dont work i click submit button page only refresh
Anonymous
I cant share images
cj
I cant share images
happily 🙂
Anonymous
forms.py https://i.hizliresim.com/P1yldb.png login view https://i.hizliresim.com/k9qOz7.png
st9_8
Hello
st9_8
Hmmm for fun?
cj
Hmmm for fun?
for free* 🤷🏻‍♂
st9_8
On which project?
hik
Hey josha
hik
İ am with you
hik
What is the pejoct about?
hik
Project
Anonymous
valar dohaeries dead man
Sagar
Hi guys. For loading static files, its {% load static %} or {% load staticfiles %}, which 1 is correct
Ronald
but
Ronald
you also need static
Sagar
Ok, it doesn't load css and images even woth staic files
Ronald
it allows you to link to static files eg <link rel="stylesheet" href="{% static '/main.css' %}">
Ronald
Ok, it doesn't load css and images even woth staic files
you loading it like {% static '/main.css' %}
Ronald
?
Ronald
development or production?
Ronald
Dev
where is your static folder?
Ronald
also in your settings.py
Ronald
STATIC_URL = '/static/'
Ronald
for production that’s a bit different
Sagar
STATIC_URL = '/static/'
Wait. I'll use paste
Ronald
Under my app
technically it should be inside your app folder
Ronald
try that
Sagar
Sagar
https://pastebin.com/zrLyCAQJ
Ronald
use this
Ronald
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
Mirco
and u need to serve them using static() django app so you need to add a line into your urls.py if debug is True
Ronald
not familiar witht he staticfiles_dirs that you’re using
Ronald
that’s weird
Mirco
if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) You have to add this code to your main urls.py to get static works on dev mode
Ronald
in your html use both {% load static %} {% load staticfiles %}
Ronald
i see one is commented out
#
I want to study django, but I couldn't get enough resources. If there is any who want to help me, attack me any resources on @erma43