sim
if yes then PLZ pm
Uday
i have a method in serializer class for validating data im raising some validation error, how do i pass and show the validation errors on template?
Uday
if username_qs.exists() and registerUser.exists(): raise serializers.ValidationError("Account with number already exists.") return value so i need to show the validation error which is raised here
Mirco
i have a method in serializer class for validating data im raising some validation error, how do i pass and show the validation errors on template?
You need to call your view with JavaScript and when the request status code is 400 you have inside the payload the error you have specified Obviously you can have multiple scenarios for 400
Uday
And go the template and write this : {% if variable_name %} {{Variable_name}} {% endif %}
ill give this a try first as this seems pretty easy without javascript
Mirco
ill give this a try first as this seems pretty easy without javascript
No you cannot Your error won't be saved in a variable first and second it's very weird
Uday
isnt there anything like the validationforms we raise in forms in normal django?
Mirco
isnt there anything like the validationforms we raise in forms in normal django?
You are using Serializers so I suppose you are using Django Rest Framework correct ?
Uday
You are using Serializers so I suppose you are using Django Rest Framework correct ?
yep, i thought that thered be something like forms here as it follows same syntax and everything
Uday
could there be any way around without using js?
Mirco
Mirco
could there be any way around without using js?
Come on they are 5 lines of code and you can write a re-usable API client
Mirco
You can use widget tweaks
It won't get the goal neither in that way
Mohammad
Hello guys, I'm fine, I just came from Windows, Linux, and when I run the rap project, the login.html page doesn't work, thank you for your help.
thenils
how to make filter form multiselected dropdown
thenils
where i have list of country and i want to let user select multiple country together
tanish
Django.db.utils.IntegrityError
tanish
Can anyone help me solve this
Xudoyberdi
Django.db.utils.IntegrityError
can you send me this your code end promlem page
faran
Hey, add the things to the settings.py file as the database as said in (https://devcenter.heroku.com/articles/deploying-python) and add the DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '<database_name>', 'USER': '<user_name>', 'PASSWORD': '<password>', 'HOST': 'localhost', 'PORT': '', } in the part of name, user, port, hosti, password I leave it by default or should I do something man
hi you should put the heoku database information. its provided in : https://dashboard.heroku.com/apps/<app-name>/settings then scroll and push the button : Reavel Config Vars there you can find DATABASE_URL you see a value for it : postgres://<user>:<password>@<host>:<port>/<name> the url there is like this you should put the following in your settings.py
Doragonsureiyā
Anyone can help me to create one simple website in django using python
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
thenils
def search(request): query = request.GET['search'] data = labels.objects.filter(Q(name__icontains=query) | Q(label_est_year__icontains=query) | Q(country__country__icontains=query) | Q(category__category__icontains=query)) # f = label_filter(request.GET, queryset = data) data2 = [] for label in data: if label not in data2: data2.append(label) f = label_filter(request.GET, queryset=data2) ctx = {'filter': f} return render(request, 'labels/filter.html', ctx)
thenils
getting error 'list' object has no attribute 'model'
Anonymous
while trying to deploy a django site using heroku,i am geeting these errors when i try to 'git push heroku master' :: ?: (staticfiles.E001) The STATICFILES_DIRS setting is not a tuple or list. -and- Error while running '$ python manage.py collectstatic --noinput'.
faran
while trying to deploy a django site using heroku,i am geeting these errors when i try to 'git push heroku master' :: ?: (staticfiles.E001) The STATICFILES_DIRS setting is not a tuple or list. -and- Error while running '$ python manage.py collectstatic --noinput'.
you got to set STATICFILES_DIRS in your settings.py and point is to the static dir for example [os.path.join(ROOT_PATH, 'static')] so : STATICFILES_DIRS = [os.path.join(ROOT_PATH, 'static')] I guess you didnt put the path in a list or tuple as follow
Anonymous
wait i will DM you some screenshots
Mirco
ok
Don't allow them to bother you They can share the code here without screenshots
faran
Don't allow them to bother you They can share the code here without screenshots
I know its a small problem there . and im free . so its ok . but its better to pastebin it.
Rahul
Hey guys!!! I am trying to build a project that contain multiple user types i.e. Seller, Customer, Admin. I am very confused about how I would implement the signup and signin processes for the different user types. So far, I have my User model and the Customer model extended by a OneToOneField to the User model for extra fields.
Rahul
Hey guys!!! I am trying to build a project that contain multiple user types i.e. Seller, Customer, Admin. I am very confused about how I would implement the signup and signin processes for the different user types. So far, I have my User model and the Customer model extended by a OneToOneField to the User model for extra fields.
In my project I am making it such that the seller is also a customer. When the customer will signup, first the form will create the User object and then create the Customer object. I am trying to implement a similar flow for the Seller but I cannot understand how do I approach if the User already exists there as a Customer
عــمــر
Hi , i want to delete all model objects on friday How can i do that with django ?
faran
hi which one is the best option for dynamic fields in django model ? JsonField or use EAV . I want to keep it as simple as possible . and if any other option please mention it. thanks
Anonymous
Hello everybody! Can you teach me how to set up a django?
Doragonsureiyā
Hello everybody! Can you teach me how to set up a django?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Pranav
Hello everybody! Can you teach me how to create view for check mail opt and entered input field is same then verify equal to true
Cacio Lucas
Guys, how can I annotate values on a queryset with information from another queryset?
Cacio Lucas
I have a products queryset, but the price is stored on another model, so, in another queryset
Cacio Lucas
I want to annotate on my products queryset the price, from this productsprice queryset
Ak
Hey Everyone! So, I am developing a blog and i intend to use djangocms for the same. My question is that how can i show all the pages created in the home page in DJangoCMS.
IND_
guys does someone use mongodb
IND_
in django i want to know how to integrate ir
Doragonsureiyā
guys does someone use mongodb
https://daniel.feldroy.com/when-to-use-mongodb-with-django.html
IND_
thanks
cj
I hope you understand that and stop being stubborn trying to use Django with MongoDB
IND_
yep which db is good then
IND_
for best peformange
cj
for best peformange
read that article... it looks like you didn't read it, did you? there's exactly one entry there: The 5% Reason: Performance but... I see you didn't read it
Nani
When we need sessions and cookies
IND_
yes but i am asking you
cj
yes but i am asking you
my answer is the same that is in that article, so read it
cj
also PostgreSQL is the *must use* RDBMS
Raja
Does any one know how to get visitor ip address and location from mobile in django
Hikmet
Hey everyone. I want to upload image for my model. Through postman and browsable API it is working fine. But using angular from client side it shows 400 error. Is it problem with angular? Or I should make changes in my side of code?
cj
You mean django code?
all your code, Django and JS
Hikmet
From django it is working fine as I say. I can easily add image to my product and it returns an object
Hikmet
I just want to know, is the problem in django?
cj
debugging involves everything... but if you know your Django code works, then debug JS code
Hikmet
again... debug it...
How to debug the thing that gives no errors?))
cj
How to debug the thing that gives no errors?))
if you're 100% sure the Django code work and it has no errors, then don't be stubborn on it and go to the JS code
cj
But my frontend college says that the problem is on server side))
then debug it ¯\_(ツ)_/¯ come on!