APY
Can anyone help me out?
I have this question
I need to implement autocomplete function in my search box of html page in django
And i need to use source as a URL which contains Json data.
What could be the code for it?
Right now i wrote this and it wont work…
<script>
$ (Function ())
$( "#name" ) .autocomplete ({
source:
“localhost:8983/solr/test/select?indent=on&g=*:*&wt=json”
minLength: 2
]):
</script>
Ing. Mario Tamayo
cj
Raj
Can anyone one help me in starting django project i am facing lots of problems
() { :;}; echo Nickolas
Bhaghi
() { :;}; echo Nickolas
() { :;}; echo Nickolas
How do you expect people to help you if you say hello i have problems. Smh
Raj
Do you want to help me? If so
I will be so glad 🥰
Eliphaz
Hey guys please do you know a method to implement like system with Django and JavaScript on a blog article ?
I created a like model with article_id , user_id and liked to default True
Eliphaz
When I add a like with JavaScript ajax I don't receive the current count value of the like in database I received old state
Eliphaz
Sorry I'm going to share a portion of my code
Eliphaz
class Like(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
article = models.ForeignKey(Article, on_delete=models.CASCADE)
liked = models.BooleanField(default=True)
Eliphaz
it's the Like model
Eliphaz
my like_request method : https://pastebin.com/aBX4LNKF
Eliphaz
sorry I'm a beginner with Django I'm learning
Eliphaz
my like_request method : https://pastebin.com/aBX4LNKF
in my urlpatterns on app/urls.py:
path('<slug:slug>', ArticleView.as_view(), name="article_detail"), #<= here the path of a article
path('ajax/like', like_request, name="article_detail_like"), #<= here the path of the ajax request
Sumit
HI, HOw to open aws s3 file from django-admin
Sumit
Used django-storages package
Sumit
opening file is giving xml output
`
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
`
() { :;}; echo Nickolas
() { :;}; echo Nickolas
Your URL/ajax code is irrelevant, explain the use case
() { :;}; echo Nickolas
() { :;}; echo Nickolas
Modelviewset gives you crud by default without writing any code
Eliphaz
() { :;}; echo Nickolas
() { :;}; echo Nickolas
It sounds to me like you're trying to build a backend and a JS based front end, look into django rest framework and it's viewsets
() { :;}; echo Nickolas
Django rest framework is django, it just separates your back end from the front end
Eliphaz
() { :;}; echo Nickolas
or in other words, django rest framework is django without the views/templates. Instead, endpoints return a JSON object unless specified otherwise.
() { :;}; echo Nickolas
DRF also comes with a browsable interface, you can use it to create/edit/delete/et. al. objects
() { :;}; echo Nickolas
All without writing any (very little) code. It's all the same, you define a model, create a serializer, define a viewset that has like 0 business logic to have CRUD OOTB and you're good to go
() { :;}; echo Nickolas
It's only when you'll want to integrate more complex stuff or build a proper application that you'll need to override the view methods or serializer methods.
Eliphaz
() { :;}; echo Nickolas
You can use JS in templates. Just define a script block and off you go
Eliphaz
Mr
hello django users. Can I create web aplication that broadcasting tv channels?
Doragonsureiyā
() { :;}; echo Nickolas
It's what I have do
You don't "have to do" anything. You need to evaluate your use case write out a design and decide on how you want to build out the app
Eliphaz
() { :;}; echo Nickolas
Well, same remarks then.
You have a POST endpoint that is supposed to increment the amount of likes on a blog post but no where in your business logic do you increment the like counter.
() { :;}; echo Nickolas
Furthermore, why is like a boolean, likes are integers
Eliphaz
Эндейл
Hey guys, how can i create simple quiz app in django, plz help me.
() { :;}; echo Nickolas
A blog has posts, a post has an author, likes, exc..
Eliphaz
I've create the like model for separate like with article model
Raj
PS C:\Users\rajla> python manage.py runserver
C:\Program Files\Python310\python.exe: can't open file 'C:\\Users\\rajla\\manage.py': [Errno 2] No such file or directory
Raj
do any one has answer
G4st0n
G4st0n
exactly, move to manage.py location
G4st0n
also if using virtualenv can use pip shell and django-admin commands
omurzhanov
Hii, I’m creating a Django website and there will be petitions app, posts app. As you already guessed, I have petitions and post models. And you can comment on petitions as well as posts. How can I implement comment model? Do I have to implement comment model to each one, like PetitionComment, PostComment ? Or how can I implement? Thank you
Philemon
Anybody who knows of Django freelance site?
Lord
'''ValueError: not enough values to unpack (expected 2, got 1)''' am trying to run my and this occurs I need help please
Navroz
Lord
the bot is not allowing it
Navroz
Lord
actually I have'nt written any views.py and urls.py am just trying to my admin page
Navroz
Lord
alright
Doragonsureiyā
the bot is not allowing it
To share code or error tracebacks, use a pasting service, like:
- https://linkode.org
- https://dpaste.org
Deep
Hi folks, django celery with redis is executing same task thousand of times. What could be issue?