-
How should django be written in such a way as SQL?
that s the question. I ve been looking for it on the Internet for a long time, but I can t find it. for example, I want to query SQL: select a from atable,btable where atable.id=btable.id
an is the field of atable and b is the field of btable. B...
-
Django how to sequence number array or specified format
query the data in this way
user_add1 = UserAddress.objects.filter(id=int(add_id))
then serialize
json_data = serializers.serialize("json", user_add1, ensure_ascii=False)
return json
return HttpResponse(json.dumps(json_data), content_t...
-
Why does it take so long for django to perform a simple database operation through queryset?
as shown in the figure, a simple add and query operation takes up to 1 second [environment: windows + python3 + django2]. (the amount of data in PS: is not much, and todo_list has only 2 rows of data, which is still so slow.)
def get(request):
-...
-
Django template inheritance, no inheritance data, is there any good way?
wrote a blog, tags has to be loaded every page, so use template inheritance, inherited there is no data, is there any good way?
I can think of a global variable or decorator. Does Django have a better solution?
...
-
What are some simple ways to localize data in Django?
We know that there are good ways to localize data such as localStorage,sessionStorage in HTML5. So what are some convenient ways to localize data in Django? ...
-
Django Migration Model entry prompt on delete
according to the book "python programming from introduction to practice ", after modifying the models.py, execute the command python manage.py makemigrations learning_logs, to report an error and ask for advice.
model.py Code
from django.db import...
-
The time problem of django
define in models.py
jiezhi_date = models.DateTimeField (blank = True, null = True, db_index = True, verbose_name = _ (u information cutoff ))
in the template:
< div style= "color:-sharpA8B1BA; " class= "text " > deadline: {{form.jiezhi_date}}...
-
Django, deletes the uploaded picture in the admin background only deletes the record of the database, but the picture still exists, could you tell me how to deal with this?
Novice django, deletes the uploaded picture in the admin background only deletes the record of the database, but the picture still exists in the media img folder. How to deal with this?
models.py
class HomePageProductPictureDisplay(models.Model):
d...
-
How to delete authentication and authorization for django admin customization
as shown in the picture, how can I delete it if I don t want to see it in the admin sidebar? seems to exist by default. ...
-
When entering background information of django database model and xadmin, second-level classification, the first-level classification is selected first, and the second-level classification is selected.
I want to make a book classification there are two categories:
(id(), name)
(id(), fist_type(), name)
there is also a book information table
()
when you want to add book information in the xadmin background, select the first category first, and th...
-
Django for unit testing
how does django import tets.py data when conducting automated testing? I export the contents of the database as api.json. Then import to the unit test database, but the unit test database does not have data, what is wrong?
where the json file of the...
-
How to customize LoginForm using django-mama-cas
I want to use django-mama-cas to complete the CAS login, but the login module that comes with the system is a little too simple. I want to add something by myself, but Form cannot set its own defined Form (LOGIN Template in the setting file. I would li...
-
On the problem of obtaining data by ajax
first of all, when the user logs in, I want to display the user s information and get the data in the profile_ajax view. This corresponds to html html
formuid
. Here is the problem. I click here to view the details. Will the ajax of html not enter th...
-
How does django receive json data from post?
how to use js post to django data in django to receive JS similar to this
str = {"student":[{"number":"0","name":"a"}]} ;
obj = JSON.parse(str);
look at the data in chrome like this
[student][0][...
-
Django uses the cookie, set by set_signed_cookie () to display the value that is not encrypted.
cookie:
response = HttpResponse()
response.set_signed_cookie("signed_cookie_name","signed_cookie_value","salt")
cookie,:
Name :signed_cookie_name
Value :signed_cookie_value:1fPSBW:_JLMVkTZzxZe7aZr7KyjXwrsBBs
...
-
Django create Learning Notes Tip cannot import name 'views'
Task: create study notes-map URL Code:
urls.py "define URL schema for learning_logs "
from django.conf.urls import url
from. Import views
urlpatterns = []
-sharp
url(r ^$ ,views.index,name = index ),
]
execution tips are as follows: ...
-
About Django secret_key running python manage.py runserver error report
secret_key cannot be empty
...
-
Why is the django routing system getting longer and longer?
I directly enter the address http: 127.0.0.1:8000 boycott ajaxTot can be opened, but the address that jumps through httpResponseRedirect is wrong? I thought I understood the routing system of django, but this example confused myself why it appeared ...
-
Django saves data Times error NOT NULL constraint failed
Save Times error after adding data
NOT NULL constraint failed:booktest_bookinfo.bpub_data
Source code
class BookInfo(models.Model):
btitld=models.CharField(max_length=20)
bpub_data=models.DateTimeField()
class HeroInfo(models.Model):
hna...
-
Problem with Nginx+uwsgi deployment django unable to load static files
Nginx and uwsgi are installed, tested, no problem, and then when using uwsgi to start the django project, using the browser to view the project will have the problem that static files cannot be loaded. No matter how to configure it, I can t do it well....