Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Unable to open unix socket in redis - Permission denied while firing up docker container
I am trying to fire up a separate redis container which will work as a broker for celery. Can someone help me with as to why the docker user is not able to open the UNIX socket. I have even tried making the user as root but it doesn't seem to work. Please find below the Dockerfile, docker-compose file and redis.conf file Dockerfile FROM centos/python-36-centos7 USER root ENV DockerHOME=/home/django RUN mkdir -p $DockerHOME ENV PYTHONWRITEBYCODE 1 ENV PYTHONUNBUFFERED 1 ENV PATH=/home/django/.local/bin:$PATH COPY ./oracle-instantclient18.3-basiclite-18.3.0.0.0-3.x86_64.rpm /home/django COPY ./oracle-instantclient18.3-basiclite-18.3.0.0.0-3.x86_64.rpm /home/django COPY ./oracle.conf /home/django RUN yum install -y dnf RUN dnf install -y libaio libaio-devel RUN rpm -i /home/django/oracle-instantclient18.3-basiclite-18.3.0.0.0-3.x86_64.rpm && \ cp /home/django/oracle.conf /etc/ld.so.conf.d/ && \ ldconfig && \ ldconfig -p | grep client64 COPY ./requirements /home/django/requirements WORKDIR /home/django RUN pip install --upgrade pip RUN pip install --no-cache-dir -r ./requirements/development.txt COPY . . RUN chmod 777 /home/django EXPOSE 8000 ENTRYPOINT ["/bin/bash", "-e", "docker-entrypoint.sh"] Docker-compose file version : '3.8' services: app: build: . volumes: - .:/django - cache:/var/run/redis image: app_name:django container_name: app_name ports: - 8000:8000 depends_on: - db - redis db: image: postgres:10.0-alpine volumes: - postgres_data:/var/lib/postgresql/data ports: - 5432:5432 environment: - POSTGRES_USER=app_name - POSTGRES_PASSWORD=app_password - POSTGRES_DB=app_db labels: description : "Postgres Database" container_name: app_name-db-1 redis: image: … -
A state mutation was detected between dispatches
I've got this issue which I do not understand. I am getting an invariant error that says a state mutation has occurred, but at a very awkward place. Basically I've got this page: import React, { useState, useEffect } from "react"; import { Link, useLocation, useNavigate, useSearchParams, } from "react-router-dom"; import { Form, Button, Row, Col, Table } from "react-bootstrap"; import { LinkContainer } from "react-router-bootstrap"; import { useDispatch, useSelector } from "react-redux"; import Loader from "../components/Loader"; import Message from "../components/Message"; import FormContainer from "../components/FormContainer"; import { register } from "../actions/userActions"; import { getUserDetails, updateUserProfile } from "../actions/userActions"; import { USER_UPDATE_PROFILE_RESET } from "../constants/userConstants"; import { listMyOrders } from "../actions/orderActions"; function ProfileScreen() { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState(""); const [message, setMessage] = useState(""); const dispatch = useDispatch(); const location = useLocation(); const userDetails = useSelector((state) => state.userDetails); const navigate = useNavigate(); const { error, loading, user } = userDetails; const userLogin = useSelector((state) => state.userLogin); const { userInfo } = userLogin; const userUpdateProfile = useSelector((state) => state.userUpdateProfile); const { success } = userUpdateProfile; const orderListMy = useSelector((state) => state.orderListMy); const { loading: loadingOrders, error: errorOrders, … -
How to test dynamically changing parameters within an sql query to the database using pytest
Function to test def get_adgroups_not_taked_share( campaign_ids: List[str], src_table: str, spend_src_table: str ) -> List[Tuple[str, str]]: start_date = ( date.today() - timedelta(days=get_redshift_query_param_value('start_date')) ).strftime('%Y-%m-%d') end_date = (date.today() - timedelta(days=1)).strftime('%Y-%m-%d') loses_adgroups: List[Tuple[str, str]] = [] with RedshiftCursor() as cursor: cursor.execute( """ SELECT ad_group, spends.campaign_id, ad_spend FROM ( SELECT ... SUM(spend_eur) AS ad_spend FROM %(src_table)s WHERE ...... ) as spends LEFT JOIN (SELECT ... AS total_spend FROM %(spend_src_table)s GROUP BY campaign_id, spend_eur ) AS sg ON ... WHERE ad_spend * 100 / %(cutoff_percent)s < total_spend """, { 'campaign_ids': tuple(campaign_ids), 'start_date': start_date, 'end_date': end_date, 'cutoff_percent': get_redshift_query_param_value('cutoff_percent'), 'src_table': AsIs(src_table), 'spend_src_table': AsIs(spend_src_table), }, ) for row in cursor.fetchall(): loses_adgroups.append((row[0], str(row[1]))) return loses_adgroups Within it, the function get_redshift_query_param_value is called def get_redshift_query_param_value(param: str) -> int: params = { 'cutoff_percent': RedshiftQuery.CUTOFF_PERCENT, 'min_place': RedshiftQuery.MIN_PLACE, 'start_date': RedshiftQuery.START_DATE, } return int(RedshiftQueryParam.objects.get(name=params[param]).value) which retrieves a numeric value from the databases based on the key passed in. Wrote a test that wets the database access and the return value test.py import pytest from google_panel.logic.clean_creative import get_adgroups_not_taked_share @pytest.fixture def campaigns_redshift_cursor_mock(mocker): cursor_mock = mocker.MagicMock() cursor_mock.fetchall.return_value = [ ('hs_video544', '123123123', 100), ('hs_video547', '123123123', 50), ] rs_cursor_creator = mocker.patch('google_panel.logic.clean_creative.RedshiftCursor') rs_cursor_creator.return_value.__enter__.return_value = cursor_mock return rs_cursor_creator @pytest.fixture def get_redshift_query_param_value_mock(mocker): return mocker.patch('google_panel.logic.clean_creative.get_redshift_query_param_value') @pytest.mark.django_db def test_get_adgroups_not_taked_share( campaigns_redshift_cursor_mock, get_redshift_query_param_value_mock): campaign_ids = ['1111', '2222', … -
Django storages: Need authenticated way of reading static files from google cloud storage
I am trying to read static files from GCP storage using a service account key. The problem is while most of the requests are authenticated django-storages, some of the requests are public. Developer console: Networks tab And because of which I am getting a broken Django admin UI. Broken Django admin UI Here's my static file settings in settings.py file. STATIC_URL = "/static/" if DEPLOYED_URL: DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage" STATICFILES_STORAGE = "storages.backends.gcloud.GoogleCloudStorage" GS_BUCKET_NAME = env("GS_BUCKET_NAME") GS_CREDENTIALS = service_account.Credentials.from_service_account_info( json.loads(get_secret(PROJECT_NAME, "service_account_json")) ) GS_DEFAULT_ACL = "projectPrivate" My restrictions are I have Fine-grained: Object-level ACLs enabled bucket on which public access cannot be given. PS: Since there are restrictions to the project I cannot use a public bucket. Alternate ways other than the usage of django-storages package are also appreciated. The only condition is reads should be authenticated and not public. -
How to refresh page for new request in Django
I want to receive a request.POST values N times, where N is a number entered by the user. The views.py is: def valores(request): global peso_unitario, preco_unitario peso_unitario=[] preco_unitario=[] N=a print('N='+str(N)) for i in range(N): form=Form(request.POST) c = int(request.POST.get('peso_u')) d = int(request.POST.get('preco_u')) peso_unitario.append(c) preco_unitario.append(d) return render(request, 'valores.html') return render(request, 'pacote_m.html', {'peso_unitario': peso_unitario, 'preco_unitario': preco_unitario}) In this code in the end I have two returns, where the first is inside the for loop because I want to receive the values N times and return them to the template "valores.html". The last return is in the end, after the for loop will redirect to a new template, this template "pacote.html" will show the values calculated according to I programmed, but it isn't the problem. The template valores.html is: {% extends 'basic.html' %} {% block content %} <form action="page2" method="GET"> {% csrf_token %} <h1>Digitados:</h1> numero de objetos={{n_objetos}}<br> peso peso maximo={{peso_maximo}}<br> <!--- Peso unitario: <input type="text" name="peso_u"><br><br> Preco unitario: <input type="text" name="preco_u"><br><br> ---> <table> <thead> <tr> <th>Peso unitario</th> <th>Preco unitario</th> </tr> </thead> <tbody> <tr> <td><input type="text" name="peso_u"></td> {{form.peso_u}} <td><input type="text" name="preco_u"></td> {{form.preco_u}} </tr> </table> <input type="submit"> </form> {% endblock %} My forms.py is: class Form(forms.Form): peso_u=forms.CharField(max_length=50) preco_u=forms.CharField(max_length=50) The problem is I can't get the N … -
can we use prefetch_related with many-to-many relationship in django
hey guys let's say i have models like this class CouponCode(models.Model): ...... class Product(models.Model): codes = models.ManyToManyField(CouponCode) how can I use perefetch_related with reverse many to many relationships I did this and I looked at the queries and I found i didn't make a query for the second table CouponCode.objects.all().perefetch_related('product_set') -
how to stop ajax waiting for its response after sending request
def openFile(request): record = Verification.objects.filter(farmRegNo= request.POST['farmRegNo']) filepath = os.path.join('', str(record[0].certificate)) # not working line #return FileResponse(open(filepath, 'rb'), content_type='application/pdf') return HttpResponse(Respon) This is code using django, since i call this openFile() by ajax, i cant work for FileResponse, it only expects HttpResponse, I want to open this file....is there any way to do this??? -
Incorrect display of children's models on the form in django
I tried to make a creation form for vacancy on my job search site, but i faced with problem. I have User model, company model and vacancy model. They are inherited by foreignkeys. And the problem is that user can use all companies for creation a vacancy instead of created by this user companies(User can create several companies). I tried to change creation form and view by filtering, but it didn't work out for me. I am new at django and i dint find anything to resolve my problem. Model of company: class Company(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE) title = models.CharField(('Title of Shop'), blank=True, max_length=255) info = models.TextField(('Information about Shop'), null=True, blank=True) updated = models.DateTimeField(auto_now=True) created = models.DateTimeField(auto_now_add=True) def __str__(self): return str(self.title) Model of vacancy: class Vacancies(models.Model): title = models.CharField(('Title of Vacancy'), blank=True, max_length=255) city = models.ForeignKey(City, on_delete=models.CASCADE, default='363') description = models.TextField(('Information about Vacancy'), null=True, blank=True) employer = models.ForeignKey(Company, on_delete=models.CASCADE) updated = models.DateTimeField(auto_now=True) created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-updated', '-created'] def __str__(self): return str(self.title) Create vacancy view: @login_required(login_url='login') def createVacancy(request): form = VacanciesForm() cities = City.objects.all() if request.method == 'POST': form = VacanciesForm(request.POST) if form.is_valid(): form.save() return redirect('home') context = {'form': form, 'cities': cities} return render(request, 'vacancy_form.html', context) … -
can't get data from Django to html
//views.py def index(request): if request.method == 'POST': data = request.POST['data'] context = {'mydata': data} return render(request, 'home/index.html', context) else: html_template = loader.get_template('home/index.html') HttpResponse(html_template.render(request)) //index.html <form method = 'POST' id = 'post-form'> <select name = 'data' id = 'data'> <option> 1 </option> <option> 2 </option> </select> <button type="submit" name = 'post-form'> submit </button> </form> <h2> {{ mydata}} </h2> // this line print nothing. When I click the submit button, I can access data from html submit in views.py. However, I can't access 'mydata ' from dajngo in html. how can i solve it? -
when I try to render tags I get Wallpaper.Wallpaper.None
views.py def download(request, wallpaper_name): try: wallpaper = Wallpaper.objects.get(name=wallpaper_name) similar_wallpapers = wallpaper.tags.similar_objects()[:2] except Exception as exc: wallpaper = None similar_wallpapers = None messages.error = (request, 'Sorry! data does not exist') context = {'wallpaper': wallpaper, 'similar_wallpapers': similar_wallpapers} return render(request, 'Wallpaper/download.html', context) models.py class Tags(models.Model): tag = models.CharField(max_length=100) def __str__(self): return self.tag class Wallpaper(models.Model): name = models.CharField(max_length=100, null=True) size = models.CharField(max_length=50, null=True) pub_date = models.DateField('date published', null=True) resolution = models.CharField(max_length=100, null=True) category = models.ManyToManyField(Category) tags = TaggableManager() Device_Choices = [ ('PC', 'pc'), ('mobile', 'mobile') ] Devices = models.CharField(max_length=20,choices=Device_Choices, default= 'PC') image = models.ImageField(upload_to='Wallpaper/Images/', default="") def __str__(self): return self.name download.html <div class="tag"> <h3>Tags</h3> <ul> <li>{{wallpaper.tags}}</li> </ul> </div> I want all the tags of that particular wallpaper to be rendered and if possible please tell me if there is any other way to handle tags, because using taggit its very difficult i am getting manny errors -
django multiple random questions with same answer options
Have this small app with a model for questions and their answers are picked from a tuple. My current challenge is to display the questions with a dropdown for the answers using a modelform. Once submitted the form should save noting the question id and answer option selected. class Question(models.Model): question = models.CharField(max_length=100) active = models.BooleanField(default=True) class Answer(models.Model): answer_options = [ ('EM', 'Exceeded Expectations'), ('ME', 'Met Expectations'), ('BE', 'Below Expectations'), ] question = models.ForeignKey(Question, blank=True, Null=True, on_delete=models.CASCADE) answer_selected = models.CharField(max_length=20, choices=answer_options, default='ME') The form layout is as follows: Question 1 Answer option dropdown Question 2 Answer option dropdown Kindly assist -
Django Handling Public API use (anonymouse users making calls to API)
I am making a simple website with as Django as backend. Ideally, you should be able to use it without creating an account and then all of your saved items ('notes') in there would be visible to anyone. For now I have created a dummy user on Django, and every time an anonymous user makes an API call to add/delete/modify a notes, on Django's side it selects dummy user as a user. It would work okey (I think) but one of Django's API can take a really long time to run (~1-2 minutes). Meaning that if multiple people are trying to make API calls while being anonymous, at some point the server will freeze until the long API finishes run. Is there a way such case should be handed on the server side to prevent freezing of server ? -
Reverse for 'tutorial_home' with arguments '('',)' not found. 1 pattern(s) tried: ['tutorial/(?P<slug>[-a-zA-Z0-9_]+)/\\Z']
Reverse for 'tutorial_home' with arguments '('',)' not found. 1 pattern(s) tried: ['tutorial/(?P[-a-zA-Z0-9_]+)/\Z'] views.py from django.shortcuts import HttpResponse, render from tutorial.models import IndexTutorial # Create your views here. def tutorial_home(request, slug): main_topic = IndexTutorial.objects.filter(slug=slug).first() print(main_topic) context = {'main_topic':main_topic} return render(request, 'tutorial/main.html', context) urls.py from django.urls import path from .import views app_name = 'tutorial' urlpatterns = [ path('<slug:slug>/', views.tutorial_home, name='tutorial_home'), ] index.html <div class="position-absolute bottom-0 start-0 w-100"> <a href="{% url 'tutorial:tutorial_home' main_topic.slug %}" class="btn btn- danger d-block rounded-0">Start Learning</a> </div> -
How to specify the value column for CSV output of data model with ForeignKey in Django
I would like to export CSV file of a Django Model that is using ForeignKey. By default, the file is exported with ID value of ForeignKey model, but I want have other column's data as value of the CSV file. Here is example models.py class Task(models.Model): name = models.CharField(max_length=100) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) assign = models.ForeignKey(Member, on_delete=models.CASCADE) class Member(models.Model): name = models.CharField(max_length=100) role = models.CharField(max_length=100) views.py def export_to_csv(request): task = task_set.all() task_list = task.values() df = pd.DataFrame(list(task_list.values())) response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=task.csv' df.to_csv(path_or_buf=response) return response If I implement as above, column for Member model would be ID. But I want to have name column of Member model on CSV file. Thank you! -
django pytest --log-level not works
I have .ini file where specified -s --log-level=WARNING And in django's settings.py LOGGING = { "version": 1, "disable_existing_loggers": False, "formatters": { "verbose": { "format": "%(asctime)s [%(levelname)s] " + " %(module)s - %(name)s: %(message)s", }, }, "handlers": { "console": { "level": "WARNING", "class": "logging.StreamHandler", "formatter": "verbose", }, }, "loggers": { "": {"handlers": ["console"], "level": "INFO", "propagate": False}, }, } But logger.info is being seen in pytest running -
Django handling different databases per country
I have a question related to Django handling different databases. I have this doubt because, I need to create a database for different countries. And, my webapp has one dns, and only one. I want to be able to handle different countries with the same dns. I have this questions in my mind but, I don't know which one is the best practice for this kind of situations... 1- In a Django Project create different apps, for each country and use a Database Router to differentiate. As: if model._meta.app_label == 'customer_data': return 'customer_db' 2 - Store a db name on session and when user logs in, sends every requests to the database related to the user. (don't have any clue of how to do this) I don't know what else I can do, besides the ones I described above. Any senior django developer, can help me with this question? and, if possible provide articles which can help me understand better... Thank you. -
Display all the uploaded files in browser in a div
I am currently working on a Django project so when customers upload a file i will store in my local disk and there is a seperate page for admin, I thought of displaying files uploaded by many users , is there any way to acheive that ?? -
Sorting by generic relations - django-generic-aggregation alternative for large querysets?
My models: class Article(models.Model): title = models.CharField(max_length=255) # reverse generic relation comments = GenericRelation(Comment, object_id_field='object_pk') class Comment(models.Model): comment = models.TextField() content_type = models.ForeignKey(ContentType, verbose_name=_('content type'), related_name="content_type_set_for_%(class)s", on_delete=models.CASCADE) object_pk = models.TextField(_('object ID')) content_object = GenericForeignKey(ct_field="content_type", fk_field="object_pk") I'd like to sort articles by number of comments. So far I have been using django-generic-aggregation (https://django-generic-aggregation.readthedocs.io/en/latest/) library and did the following: qs = generic_annotate( self.queryset, Comment.objects.filter(public=True), Count("comments__comment")) This approach worked fine when the number of articles was small. As the number of articles increases (over 10-20.000), it is getting too slow. Any ideas for an alternative how to sort a list of articles by number of comments, if the list of articles is large? -
How would I write this regular expression url pattern with path in django?
I am following a beginner django tutorial and my django version is set up to use path instead of the url and I am unsure how to write this code using path: url(r'^?P<album_id>[0-9]+,views.detail()) -
How to show FK fields in admin? DJANGO
I'm developing an e-commerce site and I'm trying to show in my ADMIN the 'produto_nome' related in my 'Ordem' table. For now, in my admin, in the 'Ordem' table, it's just showing the id of each object. Is it possible to show field 'produto_nome' in that table? Below is my models class Categoria(models.Model): nome = models.CharField(max_length=50) def __str__(self): return self.nome class Produto(models.Model): produto_nome = models.CharField(max_length=70) preco = models.IntegerField() quantidade_em_estoque = models.IntegerField() quantidade_vendida = models.IntegerField() categoria = models.ForeignKey(Categoria, on_delete=models.CASCADE) descricao = models.TextField(default='', blank=True, null=True) slug = models.SlugField(unique=True) image = models.ImageField(upload_to="products/%Y/%m/%d", blank=True, null=True) def __str__(self): return self.produto_nome def get_absolute_url(self): return reverse('produto:produto_detail', kwargs={'slug': self.slug}) class Ordem(models.Model): user = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, blank=True, null=True) data_pedido = models.DateTimeField(auto_now_add=True, null=True, blank=True) enviado = models.BooleanField(default=False, null=True, blank=True) transaction_id = models.CharField(max_length=200, null=True) def __str__(self): return str(self.id) def get_total_preco(self): total = 0 for pedido in self.produtos_itens.all(): total += pedido.get_total_item_preco() return total class OrdemItem(models.Model): produto = models.ForeignKey(Produto, on_delete=models.SET_NULL, blank=True, null=True) ordem = models.ForeignKey(Ordem, on_delete=models.SET_NULL, blank=True, null=True) quantidade = models.IntegerField(default=0, null=True, blank=True) data_add = models.DateTimeField(auto_now_add=True, null=True, blank=True) def __str__(self): return f'{self.quantidade} unidade de {self.produto.produto_nome}' def get_total_item_preco(self): return self.quantidade * self.produto.preco -
MultiValueDictKeyError on clicking of Unsubscribe in Sendgrid dynamic template
I created on dynamic template for my newsletter app and added custom unsubscribe link and passing uri to template with api in dynamic_template_data but when I click on unsubscribe line it throws error MultiValueDictKeyError at /delete/ Code for ref: models.py class Newsletter(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) subject = models.CharField(max_length=150) contents = RichTextUploadingField(blank=True, null=True, extra_plugins= ['youtube', 'imageresize', ], external_plugin_resources= [('youtube', '/static/ckeditor/ckeditor/plugins/youtube/', 'plugin.js')]) def __str__(self): return self.subject + " " + self.created_at.strftime("%B %d, %Y") def send(self, request): contents = self.contents uri = request.build_absolute_uri('/delete/') subscribers = Subscribers.objects.filter(confirmed=True) sg = SendGridAPIClient(settings.SENDGRID_API_KEY) template_id = "d-xxxxxxxxxxxxxxxxxx" for sub in subscribers: message = Mail( from_email=settings.FROM_EMAIL, to_emails=[sub.subscriber_mail], subject=self.subject) message.dynamic_template_data = { "xar_text": "Join Our Elites Club", "uri": uri } message.template_id = template_id sg.send(message) Views.py def delete(request): sub = Subscribers.objects.get(subscriber_mail=request.GET['email']) if sub.subscriber_mail == request.GET['email']: sub.delete() return render(request, 'frontend/unsubscribed.html', {'email': sub.subscriber_mail, 'action': 'unsubscribed'}) else: return render(request, 'frontend/error.html', {'email': sub.subscriber_mail, 'action': 'denied'}) urls.py from django.urls import path from . import views urlpatterns = [ path('subscribe/', views.subscribe, name='subscribe'), path('delete/', views.delete, name='delete'), ] Custom Sendgrid template code: <a href="{{uri}}" style="text-align:center">Unsubscribe</a> Error: Internal Server Error: /delete/ Traceback (most recent call last): File "C:\Users\ASUS\python_workspace\projects\venv\env\lib\site-packages\django\utils\datastructures.py", line 76, in __getitem__ list_ = super().__getitem__(key) KeyError: 'email' During handling of the above exception, another exception occurred: Traceback … -
how to run a forloop in django views.py?
i want to interate over queryset and if there is a new user added, i want to add some points for a specific user. To be more clear with what i am building: => I am writing a referral system logic in django. The referral system works fine now, but what i want to implement is this. When i refer a user which are "user 2" and "user 3", it is stored that i have refered two users, now i have also implemented a way to know if "user 2" or "user 3" which are refered by me: have gotten a new user refered by them ("user 2" or "user 3"). Now what i want to achieve is this, when there is a new user from "user 2" or " user 3 " i want to add a some points to the "user 1" which refered the two user ("user 2" and "user 3") that referred the new users. I am thinking of using a forloop to iterate over the second_level_recommended, then add the point to the profile but it doesn't seem to work or maybe the code that i wrote was wrong. This is the code that i wrote … -
How to Fix Cannot resolve keyword 'date_added' into field?
the BUG : Cannot resolve keyword 'date_added' into field. Choices are: date, entry, id, owner, owner_id, text here s My Models : from `django`.db import models from `django.contrib.auth`.models import User class Topic(models.Model) : text = models.CharField(max_length=200) date = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey(User,on_delete=models.CASCADE) def __str__(self): return self.text class Entry(models.Model) : topic = models.ForeignKey(Topic,on_delete=models.CASCADE) text = models.CharField(max_length=200) date = models.DateTimeField(auto_now_add=True) class Meta: verbose_name_plural = 'entries' def __str__(self): return self.text[:50] + "..." heres My Views functions def topics(request) : topics = Topic.objects.filter(owner=request.user).order_by('date_added') context = {'topics':topics} return render(request, 'learning_logs/topics.html', context) -
Fastest way to learn django [closed]
I am learning Django from the past 3 months and I am still at very beginner level. Like I can make class / functions / U r l s and I can take input output from user. I can manage models and database. I can do a little bit of html as well ( copying bootstrap ) ! What will be the fastest way to learn Django and come to intermediate level ? Any tips and suggestions will be highly appreciated. -
ImportError: cannot import name 'native' from 'OpenSSL._util'
This problem occurs when I run Django.I guss it related with kms-client-sdk==0.1.5