Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Python-Django ImportError at No module named urls
I have created Djnago project in digitalocean . Unfortunately, i am facing issue when i run the project ImportError at / No module named urls http://www.btcdoller.com/ digitalocean https://django-registration-redux.readthedocs.io pip install django-registration-redux file settings.py add INSTALLED_APPS = ( 'django.contrib.sites', 'registration', #should be immediately above 'django.contrib.admin' 'django.contrib.admin', # ...other installed applications... ) ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value. REGISTRATION_AUTO_LOGIN = True # Automatically log the user in. file urls.py add url(r'^accounts/', include('registration.backends.default.urls')), -
Django Datepicker Bootstrap 3 to Bootstrap 4
Right now i'm using this datepicker which runs on bootstrap 3. Question is, how can i port it to bootstrap 4 - because importing both bootstrap 3 and 4 for the same page doesn't feel right. I can't figure out all the things i need to change. I figured that i need to change date-picker.html but that's about all. Any and all help would be appreciated -
Django: Change value in request.POST to 0 if empty
I have the following form: When one of the tickets is empty, my form sends me an error with that every field is required, now I am trying to check if the form value is empty, if it's empty I want to change it to 0, so form.is_valid can be true. Anyone who can help me with that? The attached code doesn't work. It says string index out of range. def reserve_ticket(request): if request.method == 'POST': quantities = request.POST.getlist('quantity') for i in range(len(quantities)): if not request.POST['quantity'][i]: request.POST['quantity'][i] = 0 form = ReserveForm(request.POST) if form.is_valid(): print("Hello world") return HttpResponse("Hello world") else: return HttpResponse("Back to homepage") -
Django FileField attribute has no file associated with it and not uploading image
I am trying for hours but no luck. I have uploaded file before but do not know what is happened here. Please check the codes. Custom defined User Model : class User(AbstractBaseUser): objects = UserManager() username = models.CharField(max_length=250) email = models.EmailField(max_length=255,unique=True) active = models.BooleanField(default=True) admin = models.BooleanField(default=False) staff = models.BooleanField(default=False) type = models.CharField(max_length=250) job = models.CharField(max_length=250,blank=True) workplace = models.CharField(max_length=250,blank=True) description_of_user = models.CharField(max_length=250,blank=True) profile_picture = models.FileField(upload_to='profile_pics/',blank=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username','type'] def __str__(self): return self.email def get_full_name(self): return self.email def get_short_name(self): return self.email def has_perm(self,perm,obj=None): return True def has_module_perms(self,app_label ): return True @property def is_staff(self): return self.staff @property def is_staff(self): return self.staff @property def is_admin(self): return self.admin @property def is_active(self): return self.active forms.py : class userRegistrationForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput(attrs={'placeholder': 'Your Password'})) password2 = forms.CharField(max_length=30,widget=forms.PasswordInput(attrs={'placeholder': 'Confirm Password'})) email = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'placeholder': 'Your Email address'})) email2 = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'placeholder': 'Confirm email'})) class Meta: model = User fields = ('username','email','type','password','job','workplace','profile_picture','description_of_user') widgets={ # "description":forms.TextInput(attrs={'placeholder':'description','name':'description','id':'common_id_for_imputfields','class':'input-class_name'}), "username":forms.TextInput(attrs={'placeholder':'Your username'}), "email":forms.TextInput(attrs={'placeholder':'Email'}), "password":forms.TextInput(attrs={'placeholder':'Password'}), "type" : forms.HiddenInput(attrs={'value':'consumer'}), "job" : forms.TextInput(attrs={'placeholder':'Your Job'}), "description_of_user" : forms.TextInput(attrs={'placeholder':'Enter a short description about yourself'}), "workplace" : forms.TextInput(attrs={'placeholder':'Your current workplace'}), } def clean(self,*args,**kwargs): email = self.cleaned_data.get("email") email2 = self.cleaned_data.get("email2") password = self.cleaned_data.get("password") password2 = self.cleaned_data.get("password2") if email!=email2 : raise forms.ValidationError("Emails must match") if password!=password2 : raise forms.ValidationError("Passwords must … -
Error in installing Python Anywhere Helper Tool
I m begginer to Django and following tutorial from https://tutorial.djangogirls.org/en/deploy/ but stuck at this point .didnt find any source which help me to do same pravin@pravin:~/djangogirls/mysite$ pip install --user pythonanywhere Collecting pythonanywhere Using cached https://files.pythonhosted.org/packages/91/72/ea7eb1d3dc072034a90e766eadd7fe98406c8ca0664b3eeef820b7d080fb/pythonanywhere-0.0.11.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-DbYlRG/pythonanywhere/setup.py", line 1, in <module> from pathlib import Path ImportError: No module named pathlib ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-DbYlRG/pythonanywhere/ O.S : Debian 8 and Default Python Version : 2.7 -
Django : Connection refused to live_server_url
I'm using docker, selenium, and Django. I just realised i was doing my tests on my production database ; while i wanted to test on StaticLiveServerTestCase self-generated database. I tried to follow that tutorial @override_settings(ALLOWED_HOSTS=['*']) class BaseTestCase(StaticLiveServerTestCase): host = '0.0.0.0' @classmethod def setUpClass(cls): super().setUpClass() cls.host = socket.gethostbyname(socket.gethostname()) cls.selenium = webdriver.Remote( command_executor='http://selenium:4444/wd/hub', desired_capabilities=DesiredCapabilities.CHROME, ) cls.selenium.implicitly_wait(5) @classmethod def tearDownClass(cls): cls.selenium.quit() super().tearDownClass() class MyTest(BaseTestCase): def test_simple(self): self.selenium.get(self.live_server_url) I've no error trying to connect to the chrome-hub, but when i try to print my page_source, i'm not on my django app but on a chrome error message. Here is a part : <div class="error-code" jscontent="errorCode" jstcache="7">ERR_CONNECTION_REFUSED</div> I'm using docker-compose 1. Selenium.yml: chrome: image: selenium/node-chrome:3.11.0-dysprosium volumes: - /dev/shm:/dev/shm links: - hub environment: HUB_HOST: hub HUB_PORT: '4444' hub: image: selenium/hub:3.11.0-dysprosium ports: - "4444:4444" expose: - "4444" app: links: - hub I guess i did something wrong in my docker-compose file, but i don't manage to figure out what. Thanks in advance ! -
Unable to render dictionary values in Django templates
I have a dictionary that is returned by one of the Django view. I am running the below code in Django templates. {% for i in d.values %} {{ i }} {% endfor %} Output returns nothing. But if I run, {% for i in d %} {{ i }} {% endfor %} I am able to get keys. Please let me know why I am not able to print dictionary values -
how to disable the data of many to many field in admin site
model.py class Employee(models.Model): employeeid=models.IntegerField(primary_key=True, editable=True) fullname=models.CharField(max_length=500) location=models.ForeignKey(Location, on_delete=models.CASCADE) phone=models.IntegerField('phone number') user = models.OneToOneField( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, ) def __unicode__(self): return self.fullname def __str__(self): return self.fullname admin.py class holidayAdmin(FilterUserAdmin): form = select2_modelform(holiday,attrs={'width': '250px'}) fields= ('type','start_date','end_date','employees','image_ref','note',) list_display = ('type','created_by','last_modified_by','start_date', 'end_date','note','employees') error ERRORS: : (admin.E109) The value of 'list_display[6]' must not be a ManyToManyField. -
Django filter on date difference between columns
As a Django beginner I struggle with a very basic problem: Filter a table based on the date difference of two columns. I could solve this in raw SQL, but I would really want to use basic Django functions. I have the following model: from django.db import models import datetime class Race(models.Model): __tablename__ = 'race' name = models.CharField(max_length=200) country = models.CharField(max_length=100, null=True) start = models.DateField() end = models.DateField() and I want to extract races that last e.g. more than 5 days. I can somehow get a timediff column: Race.objects.annotate(tdiff=F('end')-F('start')).first() set1 = Race.objects.annotate(tdiff=F('end')-F('start')).all() set1.first().tdiff Now, how do I filter on this column, what I tried is: min_diff = datetime.timedelta(5) set1.filter(tdiff__gte=5).first() set1.all().filter(tdiff__gte=min_diff) set1.filter(tdiff__gte=min_diff).first() but this all gives: TypeError: expected string or bytes-like object Then I considered using extra to get a where clause: set2 = Race.objects.annotate(tdiff=F('end')-F('start')) set2.first().tdiff set2.all().extra(where=['tdiff>=5']) resulting in: ProgrammingError: column "tdiff" does not exist Questions in the same direction include this one and this one but none really give a solution where you filter on a new column (here tdiff). When finalizing this question I in the end did get the result that I wanted by: set1.filter(start__gte=F("end")-5) print(set1.filter(start__gte=F("end")-5).query) but I still very much would like to know how to utilize … -
Django: djangorestframework-jwt: How to use it for normal DJango views rather than DRF views
I created an api end point for creating new user using Django views rather than DRF. @csrf_exempt def user_create(request): if request.method == 'POST': form_data = json.loads(request.body) form = MyUserCreationForm(form_data) if form.is_valid(): user = form.save() payload = { 'id': user.id, 'username': user.username, } jwt_token = {'token': jwt.encode(payload, settings.SECRET_KEY, algorithm='HS256').decode('utf-8')} response = HttpResponse( json.dumps(jwt_token, cls=DjangoJSONEncoder), content_type="application/json" ) return response Now if the user is created i get the JSON with jwt token. I want to create another Django view which will verify user based on jwt token and if authenticated send me the required information. In normal django view we use @login_required which allows the middleware to check for authentication. Is there any thing similar for jwt with normal django views. I know djangorestframework-jwt works with DRF views by adding it to the middleware of DRF settings. If i add djangorestframework-jwt to the middleware settings of Django views will it work. -
Can't add foreign key in Django
I am making an API using django without restframework. I have problem on adding data via POST request. All the data are added except Foreign Key which is contact numbers it can add one or more contact numbers views.py @method_decorator(csrf_exempt) def phonebook_list(request): if request.method == 'GET': phonebooklist = PhoneBook.objects.all() serialized_data = [pb.to_json() for pb in phonebooklist] return JsonResponse(serialized_data, safe=False) elif request.method == 'POST': data= request.body.decode('utf8') data= json.loads(data) try: new_contact=PhoneBook(name=data["name"], address=data["address"], email=data["email"], note=data["note"]) new_contact.save() new_contact_number=ContactNumber( contact_number=data["contact_number"], #No Contact Numbers Added # It should add one or more contact numbers number_id=data[PhoneBook.id] #It should add the contact number/s to the contact name added together ) contact_number.save() return JsonResponse({"created": data}, safe= False) except: return JsonResponse({"error":"not valid data"}, safe=False) models.py class PhoneBook(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=100, default='address') email = models.CharField(max_length=50, default='email') note = models.CharField(max_length=100, default='note') def to_json(self): contact_numbers = [c.contact_number for c in self.contact_numbers.all()] return { 'name': self.name, 'email': self.email, 'address': self.address, 'note': self.note, 'contact_numbers': contact_numbers } def __str__(self): return self.name class ContactNumber(models.Model): number = models.ForeignKey(PhoneBook, related_name="contact_numbers") contact_number= models.CharField(max_length=30) def __str__(self): return self.contact_number This is the result in postman after I added some data The first one is the correct data, second is the wrong one I entered enter image description here -
Login with Social Media using Djoser
I am using "Djoser" library for authentication,registration,conformation in django rest framework. I want to implement login with social media like (Facebook,google). But I'm not getting up the Djoser docs http://djoser.readthedocs.io/en/stable/social_endpoints.html can Any one provide me example how to set up it and use it -
Why can't I create a migration using Python and Django?
I am trying to create tables using python/django and postgres. I create classes for each database table in model.py. When I try to create the migrations it gives me this errors: File "..\database\models.py", line 40, in class group(models.Model): File "database\models.py", line 41, in group user_id = models.ForeignKey(user) TypeError: init() missing 1 required positional argument: 'on_delete' class user(models.Model): STATUS_CHOICES = ( ('active','Active'), ('not active', 'Not active') ) user_id= models.AutoField(primary_key=True) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email = models.EmailField(max_length=70, null=True, blank=True, unique=True) phone = models.CharField( max_length=17, blank=True) gender = models.CharField(max_length=50) region = models.CharField(max_length=50) password = models.CharField(widget=models.PasswordInput) active = models.CharField(max_length=50, choices=STATUS_CHOICES, default='not active') register_date = models.DateField(default=date.today) def _str_(self): return self.user_id class train(models.Model): train_CHOICES = ( ('intercity', 'Intercity'), ('sprinter', 'Sprinter') ) train_id= models.AutoField(primary_key=True) train_type = models.CharField(max_length=50, choices=train_CHOICES, default='intercity') def _str_(self): return self.train_id class group(models.Model): user_id = models.ForeignKey(user) group_id = models.AutoField(primary_key=True) trip_id = models.ForeignKey(trip) created_date = models.DateField(default=date.today) started_at = models.DateTimeField() def _str_(self): return self.group_id I am really new to Python. I assume there are many mistakes. Could you please give a hint? Any help will be much appreciated. -
Django Queryset Thread Safe Read
I've been reading up a bit on concurrency with database transactions in Django. My question is if you are simply getting querysets to use in a Django view for instance and just essentially perform read operations without any intention of making changes to the database, should the lines of code getting the querysets still be in a transaction, knowing the models could be updated in another thread? If I seem to not be understanding something, feel free to let me know. For example.. def some_function(): ricky_obj = Model.objects.filter(name='Ricky') # maybe another thread deletes an object with the name bob at this very time. bob_obj = Model.objects.filter(name='Bob') do_some_stuff_here() return -
Django: Efficient way of obtaining a number of items based on foreign key
Here's an example: Models.py class Category(models.Model): name = models.Charfield(max_length=120 blank=True, null=True, default=None) class Product(models.Model): category = models.Foreignkey(Category) This is what i made previously: products = [Product.objects.filter(category_id=i.id)[:6] for i in Category.objects.all()] How can i efficiently obtain a list containing 6 products per category without using 'for'? -
Throwing ZeroDivisionError
I need to get a calculation of some data so, in annotate I put some maths logic with other field but whenever there is 0 it is throwing an error. I need to handle that error in annotate. My code looks like this: cch = CampaignContactHistory.objects.annotate( campaign_name=F('campaign__name') ).values('campaign_name' ).filter(id__in=cch_ids ).annotate( total=Count('lead_status'), scheduled=Count(Case(When(lead_status='10', then=1))), accepted=Count(Case(When(lead_status='8', then=1))), disputed=Count(Case(When(lead_status='17', then=1))), total_billable=(int(total_amount) / total_billable_leads) * Count(Case(When(campaign_contact__billable=True, then=1))), ) In total_billable, there is total_billable_leads variable which may have Zero(0) then on a division it will throw an error. So, please help me to handle this exception in annotate. Thanks in advance... :) -
Display answer in a Django website
I work on a small app in Django , a website where a student put a question using a form and the teacher will answer from admin site. The problem is that i can not display the answer and i dont know what im doing wrong. I attach models, template and view. models.py from django.db import models from datetime import datetime from django.db.models import CASCADE class Question(models.Model): title = models.CharField(max_length=120) question_content = models.TextField() date = models.DateTimeField(blank=True, null=True, default=datetime.now) class Meta: ordering = ('-date',) def __str__(self): return self.title class Answer(models.Model): question = models.ForeignKey(Question, related_name='answers', on_delete=CASCADE) answer_content = models.TextField() created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ('-created',) def __str__(self): return 'Answer to {}'.format(self.question) views.py from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.shortcuts import render, render_to_response from django.views.decorators.csrf import csrf_exempt from django.views.generic import ListView from registration.forms import RegistrationForm, QuestionForm from registration.models import * def question(request): if request.method == 'POST': form = QuestionForm(request.POST) if form.is_valid(): form.save() questions = Question.objects.all() return render(request, 'posturi.html', {'question': questions}) else: # if post request is not true, returning blog form = QuestionForm() return render(request, 'blog.html', {'form': form}) def question_list(request): questions = Question.objects.all() answers = question.answers // this is the problem i can not solve paginator = Paginator(questions, 6) # … -
django model field comment in database
this is the model class(django version 2.0) class Host(models.Model): host_id=models.CharField(max_length=20,primary_key=True) host_label=models.CharField(verbose_name="linux_host_label",max_length=255) the table structrue in database mysql> show create table dashboard_host; | dashboard_host | CREATE TABLE `dashboard_host` ( `host_id` varchar(20) NOT NULL, `host_label` varchar(255) NOT NULL, PRIMARY KEY (`host_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 | but how to do in the model class to get like this mysql> show create table dashboard_host; | dashboard_host | CREATE TABLE `dashboard_host` ( `host_id` varchar(20) NOT NULL COMMENT '主机id', `host_label` varchar(255) NOT NULL COMMENT '主机标签', PRIMARY KEY (`host_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 | +----------------+----------------------------------- -
File not found error while using pandas in django
I have written a naive bayes classifier for text messages and it's script is as follows: tester.py import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import accuracy_score df = pd.read_table('a.txt', sep='\t', header=None, names=['label', 'text']) ... On testing, it worked correctly. Now I have created a django project where this script and the a.txt file are placed alongside views.py and urls.py. When user enters a comment, it is processed in views file as: views.py from .tester import predictor def result(request): content = request.POST['content'] res = predictor(content) status = '' if res == 0: status = 'not spam' else: status = 'spam' return render(request, 'spammer/result.html', {'status':status,}) Where predictor is a function I have added to tester.py: def predictor(comment): tester = [comment] contest = count_vector.transform(tester) #count_vector=CountVectorizer() a = naive_bayes.predict(contest) #naive_bayes=MultinomialNB() return a[0] However on running the server, there is an error: File "pandas/_libs/parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__ File "pandas/_libs/parsers.pyx", line 695, in pandas._libs.parsers.TextReader._setup_parser_source FileNotFoundError: File b'a.txt' does not exist which is not the case. Where am I going wrong? I have installed pandas,scipy,sklearn in virtual environment using pip and tester.py as well as a.txt are in the same directory as views.py,urls.py -
Django Simple Push Notification to IOS
I want to create simple function for sending push notification to IOS devices. Inside my model i am storing Device_type and Device_token for Android i had written simple code using requests like below import requests, json def send_push_notif_android(device_token,title,msg): payload = { "to" : device_token, "notification" : { "title": title, "text": msg } } url = "https://fcm.googleapis.com/fcm/send" header = { "Content-Type":"application/json", "Authorization":"key = <app key>" } requests.post(url, data=json.dumps(payload), headers=header) I dont know how to do it for IOS i had generated Certificates.pem file and kept it in my root folder. Can someone tell me how to write simplest example like this. -
pytest-django run on development database?
While trying to run pytest-django tests on development database I found a solution in a similar question : https://stackoverflow.com/a/48097003/7773993 But it seems like it doesn't work to me In my conftest.py I have @pytest.fixture(scope='session') def django_db_setup(): settings.DATABASES['default'] = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db_name', 'USER': 'user', 'PASSWORD': 'pwd', 'HOST': 'localhost', 'PORT': 5432, } My test begin by @pytest.mark.django_db def test_create_single_with_pin_code(_django_db_setup): everyRIS = ResourceInSystem.objects.all() print("all: %s", everyRIS) The test start but there is nothing nothing in everyRIS while there is data in the development database What I am doing wrong? -
How to Initialise Json object in Django RESTframework so I will get json response after doing some python codeing?
I stuck in one problem when I tried to dump json object from python code and getting output from Django REST API. But I get following error: UnboundLocalError at /Talent_Search/ local variable 'e' referenced before assignment My serializer.py from rest_framework import serializers from searchapp.models import TalentSearchInput, EmployerInput # Talent Search Serializers class TalentSearchSerializer(serializers.ModelSerializer): class Meta: model = TalentSearchInput fields = ('Date','Title','Location','Competency_user','Comp_ID','Day_rate_lower','Day_rate_upper','hourly_rate_lower','hourly_rate_upper') # Employer Search Serializers class EmployerSerializer(serializers.ModelSerializer): class Meta: model = EmployerInput fields = ('Role','is_searchable','Title','Location','Competency_user','Comp_ID','Industry_ID') part of code where Problem comes in View.py file query = """SELECT jobs.*, Count(job_applicants.id) AS applied_count, Group_concat(job_applicants.talent_id) AS applicants FROM jobs LEFT JOIN job_applicants ON job_applicants.job_id = jobs.id AND ( job_applicants.status != 3 OR job_applicants.status IS NULL ) AND jobs.id IN ( %s ) GROUP BY jobs.id ORDER BY jobs.posting_date DESC LIMIT 10 offset 0""" #Enter the Job ID from Fetch Data in Loop cursor.execute(query, (enter_competency[0]['id'],)) print (cursor._last_executed) b = cursor.fetchall() # Convert in to Json Format Here Class we initalize for Date and Time in Json class DatetimeEncoder(json.JSONEncoder): def default(self, obj): try: return super(DatetimeEncoder, obj).default(obj) except TypeError: return str(obj) # Converted in Json form e = json.dumps(b,cls=DatetimeEncoder) #return e #json= get_job_details(enter_competency[0]['id']) #Call Output Data from Script and Display return Response(e) After run this I … -
Django: Combine DetailView with form
I am currently handling the following situation. I have a DetailView, that based on the URL slug get's data from the database. What I am currently struggling with is how to add a ModelForm to this DetailView. The form will show different ticket types, and then the user can select the quantity he wants, before clicking on continuing to get on the checkout page (ticket booking platform). The selection will be saved in the database under the ReservedItems model. Or would it be a better way to have a CreateView and load the DetailView data into that? I am a bit confused what approach is best, and how to do it. Could you guys help me? Here a picture how it should look like (currently not functional): Current views.py class EventDetailView(DetailView): context_object_name = 'event' def get_object(self): organiser = self.kwargs.get('organiser') event = self.kwargs.get('event') queryset = Event.objects.filter(organiser__slug=organiser) return get_object_or_404(queryset, slug=event) Template: <h1>{{ event.name }}</h1> <small class="text-muted"> <em>Presented by <a href="{{ event.organiser.get_absolute_url }}">{{ event.organiser.name }}</a></em> </small> <div class="card mt-3"> <div class="card-body"> Short description: {{ event.short_description }} </div> </div> <div class="container mt-5"> <form action="{% url 'checkout:reserve_ticket' %}" method="post"> {% csrf_token %} {{ form }} <button type="submit" class="btn btn-primary">Continue</button> </form> </div> models.py class ReservedItem(models.Model): order_reference … -
Invalid file when uploading form in Django with a file field
I am new Django and am creating a social network website to get my hands on it. I have made a form for uploading profile picture and successfully rendered in my template but when I am uploading it I am getting an error named profile_pic. Please help me out with this. views.py - This is the processing that I am doing. I get here an invalid form error and the line return HttpResponse(profilePicForm.errors) returns profile_pic as response. if request.method == "POST": profilePicForm = ProfilePicForm(request.POST, request.FILES) if profilePicForm.is_valid(): return HttpResponse("<h1>Valid</h1>") profilePic = ProfilePictures() query = UserInfo.objects.filter(id=id) for user in query: profilePic.user = user break profilePic.profile_pic = profilePicForm.cleaned_data['profile_pic'] profilePic.save() return redirect('newsfeed:profile') else: return HttpResponse(profilePicForm.errors) forms.py - The form class class ProfilePicForm(forms.Form): profile_pic = forms.FileField() profile.html - This is how I am rendering it. <form action="{% url 'newsfeed:uploadProfilePic' %}" method="post"> {% csrf_token %} {{ profilePicForm.as_p }} <button type="submit">Upload</button> </form> -
How can i decide that for my use case which one should be great Laravel framework or Django
How can know that for my project which framework will be suitable PHP Laravel or Django