Answer the question
In order to leave comments, you need to log in
Getting data from server?
Help, please, I don’t know how to get data from the DJANGO database.
I need to do this from a third-party application that is not connected to the server
Created a model
class Visited(models.Model):
latitude = models.DecimalField(max_digits=8, decimal_places=6) # широта
longitude = models.DecimalField(max_digits=9, decimal_places=6) # долгота
country = models.CharField(max_length=200)
def __str__(self):
return self.country
Answer the question
In order to leave comments, you need to log in
It's not clear what exactly is needed.
I want to pull this data from the database with a request to the server
# urls.py
urlpatterns = [
path('get-records/', views.get_records, name='get-records'),
]
# views.py
from mainapp.models import Visited
# вьюха, которая обрабатывает ваш запрос
def get_records(request):
all_entries = Visited.objects.all()
# ну и дальше уже что там нужно с ними
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question