Guru
How to define group based users roles using MySQL I am fresher in django any help would be appreciated
kam
It's up to u and nowadays with HTMX you don't need to build a SPA for frontend especially if you are solo developer So you can enjoy of the power of Django templates even if you wanna build APIs
Can you elaborate on that please? Isn't rest and django itself are like 2 different projects? Or is there a way to later turn standard django backend to become REST API
T4P4N
django is web framework
django rest framework is used turn into rest api
T4P4N
django rest framework is used turn into rest api
with your existing business logic
kam
with your existing business logic
So i can start with default django for website and when needed turn my backend into an API to maintain both website and mobile applications? How labor intense is that?
T4P4N
typically blog things can turn into api within few hours max
kam
depends upon how much complexity you're working with.
What if it is something like reddit in terms of functionality and not the scale. A lot of user interactions between each other and the platform? What would be you guess
kam
depends upon how much complexity you're working with.
If blog takes a couple of hours, then somethin with user interactions would take a couple of weeks? If it is that simple, then I would say it is relatively easy and I should not worry about such matters now.
kam
Django Rest Framework is a Django app The project will be 1
So to turn backend into REST i just need to add an app? But what I was really curious about is HTMX and that I don't need to build SPA. Does this mean that amount of JS will be reduced?
kam
Yeees! To both
Got it, thanks!
Shabaz
When I'm doing cv2.imread() its opening a seperate window, I want that window to be opened in to my webapp i.e. chrome
Doragonsureiyā
Got it, thanks!
You're welcome! 😊
Jerome
Hello guys I create a model that have a field of imagefield so anytime I am trying to upload an image to this field in my admin page it will be telling me error 38 function not implemented Please help me out
You need to create a model & a class admin specifically for your images. You foreign key the model image to your main model then in admin eg class MyImageAdmin(admin.StackedInline): model = MyImage then in your MainModelAdmin you attached your images with that field: inlines = [MyImageAdmin] Like so, you can have multiple images available, that you can chose & select. With pillow, it works like a charm
yusof
hey guys i have model name like this class User: #some field def device_login_count(self): return self.devicelogin_set.get_login_count(user=self) and devicelogin is a reverse key to another model like this: class DeviceLogin: user = foreignkey(User) def get_login_count(self, user): return self.get_login(user=user).count() does anyone know how should i use prefetch related to decrease queries for each user ?
Mohd
Hi guys, I loaded some html files in my django project and tried to acces them. The relative url of html is not working properly. Did anyone experience this?
CARPE
Hi guys, I loaded some html files in my django project and tried to acces them. The relative url of html is not working properly. Did anyone experience this?
Try the answer at https://stackoverflow.com/questions/42826048/how-to-load-external-html-into-html-inside-django-template
Ata Ul Munim
Hello guys! Facing "apps aren't loaded yet" error while setting up asgi Can anyone help??
Joao Paulo
Hello ! Can someone Help me? I need to implement a funcion wich returns the number of visualizatios of an especific object from a model class. This object comes from the search bar. Thanks !!
Semyon
Sanket
In ajax delete function
Sanket
Anyone know
Kazi
✋ guys, I am stuck at django social logging using firebase in django rest framework. Can anyone help me out of this? Or any video or blog suggestions would be great!
Charly
Anyone know
Know what? You haven't asked a question you just said random things
Kazi
Better you explain what are you doing and where are you stuck
Ok. I want some resources where social login with google, facebook could be done with firebase in django rest framework. What will be the steps for doing this?
Ajay
Hi guys, I am having a problem while using jinja in css background URL style="background-image:url({% static '/images/beach.svg' %})"
Ajay
if i do this it shows multiple errors
Ajay
) expectedcss(css-rparentexpected)
Ajay
semi-colon expectedcss(css-semicolonexpected) at-rule or selector expectedcss(css-ruleorselectorexpected)
Ajay
Which ones ?
these 3 errors
Charly
Ok. I want some resources where social login with google, facebook could be done with firebase in django rest framework. What will be the steps for doing this?
First google result: https://www.mindbowser.com/implementation-of-social-authentication-by-using-firebase-with-django-rest-framework/
Anonymous
semi-colon expectedcss(css-semicolonexpected) at-rule or selector expectedcss(css-ruleorselectorexpected)
First, put a semicolon just after the closing parenthesis. Then try again.
Anonymous
I am using django rest, i had 2 apis, in one api i need only 2 field from the serializer and other api i need full fields from serilaizer, i need to use only one serializer for both the above cases, can i use the same serilaizer for this?
Ajay
First, put a semicolon just after the closing parenthesis. Then try again.
It does not help another error : at-rule or selector expectedcss(css-ruleorselectorexpected) is added It goes away if I remove the % or replace it with semi-colon but then the code won't work
Anonymous
It does not help another error : at-rule or selector expectedcss(css-ruleorselectorexpected) is added It goes away if I remove the % or replace it with semi-colon but then the code won't work
Take a look at this. It may help. https://stackoverflow.com/questions/57352156/error-property-value-expected-css-and-at-rule-or-selector-expected-css-editi#
not_found
I am trying to save json.file data into djnago dB, So I am facing error when I am try to save "" in integer field how I can save blank("") in integer field
not_found
Charly
You know ajax Or not?
I know, but havent asked anyquestion
Sanket
How to delete a table row using ajax
Charly
How to delete a table row using ajax
It depends on what does represent that row, a model instance? If yes just create a view to handle the delete, and do your ajax request to do it
Sanket
deleteItem: function (row) { return $.ajax({ method : "GET" type: "DELETE" url: "(%ur1 delete )" +table . id, data:(" row" : row, "table" ; table)
Sanket
I have created ajax like as
fn
Hi everyone! Did anybody try django-filter package? Case: Two models, X and Z. Z model has foreign key field pointing to X model. In views, I am counting the number of objects of Z model according to the objects of X model using query with annotation() to X model and rendered it. Question: How to filter X model's query, that is rendered to .html using another field of Z model?
Anonymous
It worked, thanks a lot
You are welcome.
Aris
HI, Is MPTT not working anymore on django 4.0
Amit
def profileform(request): if request.method == "POST": name =request.POST.get('name') mail_id =request.POST.get('mail_id') mobile_number =request.POST.get('mobile_number') about =request.POST.get('about') address =request.POST.get('address') interest =request.POST.get('interest') profile_img =request.FILES['profile_img'] profileform =Profile(name=name, address=address, profile_img=profile_img, mail_id=mail_id, mobile_number=mobile_number, about=about, interest=interest) profileform.save() return render(request, 'createprofile.html')
Amit
MultiValueDictKeyError at /createprofile 'profile_img' Request Method: POST Request URL: http://127.0.0.1:8000/createprofile Django Version: 3.2.9 Exception Type: MultiValueDictKeyError Exception Value: 'profile_img' Exception Location: C:\Users\mohan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\django\utils\datastructures.py, line 78, in getitem Python Executable: C:\Users\mohan\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe Python Version: 3.9.10
Amit
i m getting multivaluedictkey error
Amit
please help
Amit
you are not sending a field with that name
class Profile(models.Model): name = models.CharField(max_length=200) mobile_number = models.CharField(max_length=200) mail_id = models.EmailField(max_length=200) address = models.CharField(max_length=200) about = models.CharField(max_length=200) interest = models.CharField(max_length=1000) skills= models.ManyToManyField(Langauge_skill) profile_img= models.ImageField(upload_to='media/profileimg',blank=True) def str(self): return self.name
Anonymous
How to save particular field object in drf serializer in def save(self)
Amit
is it right sir i m fresher so i m not getting your point
Amit
http://dpaste.org/nDZt
Amit
show it
done i have added enctype='multipart/form-data' in form tag
Amit
STATIC_URL = '/static/' STATICFILES_DIRS = [ BASE_DIR / "static", ]
Amit
Add this in seetings.py
PRAVEEN
also make sure you add {% load static %} in your template 🙂
Samaneh
Hi guys. How can i load Form error feild in my template?
Amit
Then only add static URL only
أيمن سليم عامر
Hi guys, i have two applications one is django and the other is flask in need to use make_password in flask to rest django user password
༆𖤍ཽ🇻 G⃖r༙e༙y༙h༙a༙t༙⚚×͡×
Hey guys, I want to make django app in which user can submit questions and answers and also with like and dislike button then what should I do
༆𖤍ཽ🇻 G⃖r༙e༙y༙h༙a༙t༙⚚×͡×
Anyone can help 🙏
Haresh
Study
Nirav
Read django official document
It has readymade poll application
༆𖤍ཽ🇻 G⃖r༙e༙y༙h༙a༙t༙⚚×͡×
It has readymade poll application
In poll app questions and answers are already present but i want that user can create a question and answer to that question