These are chat archives for django/django

Feb 2018
Feb 20 2018 01:44
anyone have experience with django oscar
Feb 20 2018 12:00
can anyone tell me how to store images in local folder ?
Feb 20 2018 12:09
@Nagaraj-Sambra Hello first you need to create a foulder in the main of your project called static that foulder can contain CSS and JS and IMAGES in this foulder you can put you images there or create another foulder on it for all your picture and then go to settings in your project and create the path of your static foulder like that : Search for BASE_DIR in the top of settings file and create another variable for the static path : STATIC_DIR = os.path.join(BASE_DIR, 'static') and in the bottom of settings file under STATIC_URL = '/static/' create a list STATICFILES_DIRS = [STATIC_DIR] now everithing its gonna be good for you
Feb 20 2018 12:11
@Sadhr i got it, after doing all this, how to access those images in ?
Feb 20 2018 12:20
@Nagaraj-Sambra Okay if you wanna put the image in the css you can use the normal way url(/static/images/sample.jpeg) and if you wanna use the image directly in the html foulder you will call in the top of you html after <!DOCTYPE html> call {% load load staticfiles %} and in the image tag do that <img src='{% static "images/here_your_image.jpg" %} I hope this explination helping you
Ferruccio Balestreri
Feb 20 2018 15:19
hey there!

i need help with a view. I have a User model which is the django standard that is extended by this

user_fr = models.OneToOneField(User, on_delete=models.CASCADE)
age = models.IntegerField(3, null=True)

So i'm inside a view and want to access the "age" using the request.user, but and both don't work

It should be extremely easy and obvious how to solve this, but I can't 😂
Ferruccio Balestreri
Feb 20 2018 16:10
okay fixed it
Mehmood Deshmukh
Feb 20 2018 16:11
Umar Sohail
Feb 20 2018 19:53
How can i make a view function that checks that user is not submitting an empty comment.
Feb 20 2018 20:18
Check it's length.
Sanjeev Sharma
Feb 20 2018 20:29
if request.method == 'POST':
form = Campus_Ambassdor_Form(request.POST) = request.POST['email'] = request.POST['phone'] = request.POST['name']
form.college_name = request.POST['college_name']
form.college_address = request.POST['college_addr']
form.ca_code = request.POST['ca_code']
form.reason_ca = request.POST['textarea']
print(,,,form.college_name,form.college_address,form.ca_code, form.reason_ca)
if form.is_valid():
page =
email_id =
phone =
This form works. I am getting values in the back-end but form.is_valid() fails. and the else block gets executed. Any idea?