techy
Which best website to study Django
New to Django? here is some resources to start
Official docs tutorial
Django Girls
simpleisbetterthancomplex.com
Mozilla Developer Network
#videos
thenewboston
sentdex
#books
Django by Example
Tango with Django
Two Scoops of Django
Django ORM Cookbook
Naveen
I will recommend #netninja video on Django..really simple
Mirco
007
Exception Value:
Cannot assign "'Lead'": "CustomerProfile.status_level" must be a "CustomerEnquiryStatus" instance. url :- https://dpaste.de/iFA7#L8
007
How to solve this issue ?
Oğuzhan
status_level because of this is foreign key you can not do that
007
Oğuzhan
You need to send a data which should be an id to it
007
Means ? But status_level is charfield
Oğuzhan
Yes
Oğuzhan
You need to convert it as charfield
007
Can you share me the code , how to save text to status_level ?
krishna
Hello, I just started learning django
I am trying to upload an image which saves to db and it should show image in UI as well.
It is saving to db.but the image is not showing inthe ui
krishna
Can any one guide me to show the image in ui
Oğuzhan
Oğuzhan
Did image appear when you upload?
krishna
Oğuzhan
Anonymous
hello i have a few questions
Anonymous
how can i not let users see login and signup form after they have loogin successfully ?
krishna
Oğuzhan
In template?
Mirco
Oğuzhan
Anonymous
i did that and but when i put in the login url it still show the form even thou am logged in
Oğuzhan
In view you should consider login_required decorator
Mirco
Anonymous
ok
krishna
that is my views.py code
Mirco
Use pastebin or similar pls
Read ⬇️
krishna
sorry
krishna
def uploadimg(request):
if request.method == 'POST':
form = imgForm(request.POST,request.FILES)
if form.is_valid():
#image = request.FILES['image']
img = request.FILES.get('image')
form.save()
return render(request,'sucess.html',{'img':img})
else:
form = imgForm()
return render(request,'index.html',{'form':form})
krishna
that si my views code to save and show image
Oğuzhan
This is not related with your code problem is your url.
Oğuzhan
I mean your problem
krishna
<img src="{{ img }}" />
krishna
that si how i am calling in html page
Oğuzhan
Where you save your image? What is the path?
krishna
media folder
krishna
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
Сергей
can anyone help me with this error
OSError: cannot identify image file my.jpg
image exist by I recieve this error
I use python3 django and wanna open image by from PIL import Image
Anonymous
krishna
no its not working
krishna
when i upload image train.png it is changing name to train_ytafsy.png
krishna
is that the issue?
Сергей
how can I save image to image field from file system programstecly?
Anonymous
this is my code
Anonymous
We cannot help ya until you don't send your code
{% if not request.user.is_authenticated %}
<div class="link-btn">
<a href="{% url 'login' %}" class="btn-style-one">LogIn</a>
<a href="{% url 'register' %}" class="btn-style-one">Signup</a>
{% else %}
<a href="{% url 'logout' %}" class="btn-style-one">LogOut</a>
{% endif %}
Mirco
Mirco
You need to check it into your views as well and redirect user where you want to
Anonymous
Anonymous
ok
Mirco
ok
Try to let templates just display data, make your logic into views/models
Anonymous
ok thank you
Anupam
Please can anyone suggest links to better understand usercreationform concept.
Anonymous
Anonymous
Hey, I am creating a doctor appointment app in which I create a Schedule Model which contains date field and Boolean field.
Boolean field shows that date field is older than today or not and I want to check all schedule objects in every 24 hours and update its Boolean field automatically.
Ex. I just created a schedule object with date value 14 June and I want tomorrow to change Boolean field of all schedule objects automatically
GOD OF THUNDER ️
Hii
Guilherme
Guilherme
This is my suggestion.
GOD OF THUNDER ️
Anyone help mi for create chatbot
Guilherme
Or you can use async requests inside your view in Django
Anonymous
GOD OF THUNDER ️
Plz
GOD OF THUNDER ️
Anyone help mi for create chatbot
George
George
Let me 🦆 DuckDuckGo that for you:
🔎 django channels
Mirco
Gaurav
Hi Everyone
I am working on a project and I am using celery for the data processing in that I have arroyn 20 tasks which are scheduled to run daily but some of these are long running tasks my celery app is taking much space on server I need to overcome this problem to reduce the space requirement
Is there anyway through which we can only load fixed size scripts in celery so that it will not consume much space?
Сергей
hi I have ProcessedImageField what is the way to write image from directory?
Anonymous
Hi
I wanna ask about what’s the best practice for these model fields
Representing gender : by multiple choice with numbers or simply by M,F.
Limiting a range of numbers to be entered in the field, e.g, entering only numbers between 10-40
Thanks 🌹
Mirco
Anonymous
Anders (izzno / gooood) 🇳🇴
Anyone know if theres a max number/time for
SESSION_COOKIE_AGE