Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Not able to post the data in Django Restframework
I have added the experience details for the user using following models models.py class WorkExperienceData(BaseObjectModel): class Meta: db_table = 'workexperience' verbose_name = 'WorkExperience Data' user = models.ForeignKey(User, related_name="related_experience_detail", on_delete=models.PROTECT) company = models.CharField(max_length=500) designation = models.CharField(max_length=500) description = models.TextField(max_length=4000, default="") from_date = models.DateField(null=True) to_date = models.DateField(null=True, blank=True) reference_name_and_position = models.CharField(max_length=250) reference_mailid = models.EmailField(max_length=255, unique=True, db_index=True) My serializers are following Serializers.py class WorkExperienceSerialzer(BaseModelSerializer): hidden_fields_to_add = {"created_by": None, "user": None} def __init__(self, *args, **kwargs): many = kwargs.pop('many', True) super(WorkExperienceSerialzer, self).__init__(many=many, *args, **kwargs) class Meta(BaseModelSerializer.Meta): model = WorkExperienceData fields = [ "company", "designation", "description", "from_date", "to_date", "reference_name", "reference_mailid", "user", "id", ] My views are following views.py class WorkExperienceListView(APIView): """ List all snippets, or create a new snippet. """ def get(self, request, format=None): experience = WorkExperienceData.objects.all() serializer = WorkExperienceSerialzer(experience, many=True) return Response(serializer.data) def post(self, request, format=None): serializer = WorkExperienceSerialzer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class WorkExperienceDetailsView(APIView): """ Retrieve, update or delete a snippet instance. """ def get_object(self, pk): try: return WorkExperienceData.objects.get(pk=pk) except WorkExperienceData.DoesNotExist: raise Http404 def get(self, request, pk, format=None): experience = self.get_object(pk) serializer = WorkExperienceSerialzer(experience, many=True) return Response(serializer.data) def put(self, request, pk, format=None): experience = self.get_object(pk) serializer = WorkExperienceSerialzer(experience, many=True, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) def … -
How to get a better formatted JSON Response in DjangoRestFramework UI
I have an APIVIEW in DRF which I have written some views in it to get some Response, I would like to get a better formatted JSONResponse. Views.py class Pay(APIView): def get(self, request): url = "https://api.paystack.co/transaction/verify/262762380" payload = {} files = {} headers = { 'Authorization': 'Bearer SECRET_KEY', 'Content-Type': 'application/json' } response = requests.request("GET", url, headers=headers, data= payload, files=files) return Response(response) This is a pictorial representation of the bad formatted JSONResponse I am getting which I would like to improve. Thanks -
How to import images from media_url to template.html in Django?
Well I am encountering a strange issue in my Django app. My app (in a loop) import an image into the media_url and then it goes to the next page and shows the image and goes back to first page. This was working very well yesterday. Today when I restart the server, the image goes to the media_url as before, but what I see in the next page is not what it is on the media_url and actually it is a picture that was imported before. here is the important part of the code: settings.py: MEDIA_ROOT = 'media//' # I test the MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = 'media//' views.py: def scraping(request): .... template_name = "scraping.html" response2 = {'media_root': Config.MEDIA_ROOT, 'media_url': Config.MEDIA_URL} return render(request, template_name, response2) scraping.html <img src='{{media_url}}/pic.jpg//'> # I also tried {{media_url}}pic.jpg {{media_url}}/pic.jpg/ {{media_url}}//pic.jpg// ... It is surprisingly showing different images for each line Can you help me please? It seems that maybe! the media_url is not updating after each loop. I have no idea! -
how show favorite list in django
I have a list of favorites and I want to show them when I click on the interest button after I click on the list and my heart will be bold. The second part, ie filling the heart, is done correctly, but when I want to show the list, it does not show anything and gives the following error. Reverse for 'show_Book' not found. 'show_Book' is not a valid view function or pattern name. model.py class Book (models.Model): BookID= models.AutoField(primary_key=True) Titel=models.CharField(max_length=150 ) Author=models.ForeignKey('Author',on_delete=models.CASCADE) Publisher=models.ForeignKey('Publisher',on_delete=models.CASCADE) translator=models.ForeignKey('Translator',null='true',blank='true',on_delete=models.SET_NULL) favorit=models.ManyToManyField('orderapp.Customer',related_name='favorit', blank=True) view.py def show_Book(request,BookID): showBook=get_object_or_404(Book,BookID=BookID) is_favorite=False if showBook.favorit.filter(id=request.user.id).exists(): is_favorite=True return render (request , 'showBook.html', {'is_favorite':is_favorite,}) def favoritbook (request, BookID): showBook=get_object_or_404(Book,BookID=BookID) if showBook.favorit.filter(id=request.user.id).exists(): showBook.favorit.remove(request.user) else: showBook.favorit.add(request.user) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) def favoritlist(request): user=request.user favoritbooks=user.favorit.all() context={'favoritbooks':favoritbooks} return render (request,'favotritlist.html',context) url.py path('showbookstor/<int:id>', views.show_BookStor, name='show_BookStor'), path('books/favorit/<int:BookID>/', views.favoritbook, name='favoritbook'), path('books/favorit/', views.favoritlist, name='favoritlist'), showbook.html {% if is_favorite %} <li id="sell"><a href="{% url 'favoritbook' showBook.BookID %}">add to favorit <i class="fas fa-heart"></i></a> </li> {% else %} <li id="sell"><a href="{% url 'favoritbook' showBook.BookID %}"> delete favorit <i class="far fa-heart"></i></a> </li> {% endif %} favoritlist.html {% for Book in favoritbooks %} <section id="card" class="col-md-6 col-lg-3 col-sm-6 col-xs-12"> <a href="{% url 'show_Book' Book.BookID %}"><img src= {{Book.Image.url}}></a> <h1 id="bookname">{{Book.Titel}}</h1> <p>{{Book.Author}}</p> </section> {% endfor %} -
Django // How do I need to setup user data management?
I'm working on a pwa with django and I almost done all the front/backend and I'm now facing which might be the last part to put in place (I believe and hope so !) : User Data Management I already had a look at Django's documentation regarding user/group management and I think it is quite logical and understandable however I'm really stuck on how should I implement all of this according to my project ? And especially how should I manage user's data ? Today, the development part is already setup with models/data saving/editing. But there's no user dimension for now, everything created and stored in the database is "general" (I'm using SQLite3 mainly because it was easier to deal with for development and testing but I'm clearly not fixed to it and I can easily readapt parts of the code based on the chosen database and how it work, even more if other database are better adapted to what I am looking for). To give you a bit of context the application should allow anyone to create an account to access the app. When he user is logged on, he/she will be able to arrive on an interface with … -
Optimal Way to Add Dynamic Fields or Preload Initial Values for Django Models
So... I'm working on Django Project in which a question form will be presented to the user. The questions are all yes or no so it will be easy to do that on a database. NOT! for me at least. I've been scouring Google, Django Docs, et al. looking for an answer to this however the only answer I can think of is the one I will be presenting below. GOAL: Make a model class named EmployeeMedicalQuestions in which I will store all the responses sent by a user referencing a One-to-One Relationship with EmployeeProfile. PROBLEM: I have realized that to ask the same questions for all the users, I need to reinitialize the questions for each of them because of the One-to-One Relationship. With my novice experience in Django and Python, I really don't have any idea how to do this 'programmatically'. I also don't want to hard-code the questions (because they might change) as model.BooleanField() one-by-one because I'm too lazy to do that and defeats the purpose of 'dynamic' content. And it's boring. OPTIMAL SOLUTION: I have created a way to overcome this, though by programmatically creating multiple model.BooleanField() variables. Take a look at the code below: models.py … -
Is there any way to make a Cross Login authentication via external API from django view?
Is there any way to make a Cross Login authentication via external API from django view? I need to make request for login, then if this token exists, will be authenticated to the external API. I am googling for a very long time but could not find anything useful. Any help would be appreciated -
best free api for VIN decoder
try to find vin decoder but I did not find please Introduce one website that free and have document for VIN decoder thanks -
Django, don't localize datetimes in views
I'm having trouble understanding how timezones in Django works. Let's say I have a third party API that I get data from with a timestamp of: 2020-10-26 05:00:00 now, let's say that in my view I have a query that filters all of the records from Yesterday ( October 26th) if I have a user that looks at that endpoint in the states, he will see data from October 25th (because in his time zone he is still on the 26th) but I want him to see the data as if he was on the time zone of the original request so he can see this time stamp. -
Use nested dictionary as a datasource for Datatables
I'm new to JS and Django. I have a nested dict in python containing some data that I'd like display in Datatables in Django framework. The dict looks like: {'report': {'country': {'country1': {'POP Count': 15.0, 'POP Age': 2.0, 'Issues': 35.0}}, {'country2': {'POP Count': 16.0, 'POP Age': 1.0, 'Issues': 2.0}} {'city': {'city1': {'POP Count': 16.0, 'POP Age': 1.0, 'Issues': 4.06}}, {'city2': {'POP Count': 16.0, 'POP Age': 1.0, 'Issues': 3.099}} }}} The webpage has two datatables - per country and per city and I'm trying to use this dict above as the datasource in the following way: {{ report.country|json_script:"country_json" }} {{ report.city|json_script:"city_json" }} var country_json = JSON.parse(document.getElementById("country_json").textContent); var city_json = JSON.parse(document.getElementById("city_json").textContent); $('#CountryTable').DataTable({ "data": country_json, "column": [ { "data": "POP Count" }, { "data": "POP Age"} ] }) What I'm trying to achieve is for the Country Table to look like this: Country | POP Count | POP Age | Issues -------------------------------------- Country1| 15.0 | 2.0 | 35.0 Country2| 16.0 | 1.0 | 2.0 When I do this, the datatable goes wonky with all my leaf items merged as a string into a single column. I think the nested dictionary isn't being read properly. How do I get my nested dict get read … -
how to modify nested object field inside get_object
I have the following models: class Course(TranslatableModel): thumbnail = ResizedImageField(size=[342, 225], crop=['middle', 'center'], blank=True, null=True) # thumbnail = models.ImageField(blank=True, null=True) students = models.ManyToManyField(UserProfile, related_name='courses') created_by = models.ForeignKey(UserProfile, related_name='course_created', on_delete=models.CASCADE) languages = models.ManyToManyField(Language) categories = models.ManyToManyField(Category) default_language = models.ForeignKey(Language, on_delete=models.CASCADE, related_name='def_language') price = models.FloatField(null=True, blank=True, default=0.0) user_group = models.ManyToManyField(UserGroup, related_name='courses', null=True, blank=True) date_creation = models.DateTimeField(auto_now_add=True, null=True, blank=True) translations = TranslatedFields( title=models.CharField(max_length=50, null=False), description=models.CharField(max_length=500, blank=True, null=True) ) and `class Module(TranslatableModel): thumbnail = models.ImageField(blank=True, null=True) course = models.ForeignKey(Course, related_name='modules', on_delete=models.CASCADE) avatar = models.ForeignKey(Avatar, on_delete=models.CASCADE) room = models.ForeignKey(Room, on_delete=models.CASCADE) evaluation = models.BooleanField(null=True) translations = TranslatedFields( title=models.CharField(max_length=50, null=False), description=models.CharField(max_length=500, blank=True, null=True) ) def __unicode__(self): return self.safe_translation_getter('title', str(self.pk))` the thing that i want to do is that when i do a get of a given course (example:website/api/courses/3) If the field of the module title is empty( means no translation was performed), instead of showing the empty field it returns the field with the original language. This is the code inside get_object: def get_object(self): """ Returns the object the view is displaying. You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf. """ queryset = self.filter_queryset(self.get_queryset()) #print(queryset) # Perform the … -
I want to put data got in Django server into Elasticsearch
I want to put data got in Django server into Elasticsearch. Now I made application named app,I wrote codes in app/admin.py from django.contrib import admin from .models import User, Info class UserInfoAdmin(admin.ModelAdmin): list_display = ( '__str__', 'user', 'info', ) admin.site.register(User) admin.site.register(Info) in app/models.py from django.db import models from django.contrib.auth.models import User class User(models.Model): user_name = models.CharField(max_length=10) pass = models.CharField(max_length=20) class Info(models.Model): foreign_key = models.ForeignKey("auth.User", on_delete=models.CASCADE, verbose_name="foreign_key") adress = models.CharField(max_length=200) When I run Django server,username & password & adress info was saved in admin. I want to save these data Elasticsearch.I already installed elasticsearch-dsl-py,read README.(https://github.com/elastic/elasticsearch-dsl-py) However README has only Search Exaple and I cannot understand how to save data Elasticsearch via elasticsearch-dsl-py. Also should I write searching code of Elasticsearch in Search Example in app/models.py?Should I make another file in app directory? Please give me advices. -
DJANGO not receiving data with POST
I'm having an issue trying to send data with fetch to DJANGO. I want to send some data to django through fetch but when I debug I receive nothing in the post value, do you know what could be happening? This is my fetch call: const defaults = { 'method': 'POST', 'credentials': 'include', 'headers': new Headers({ 'X-CSRFToken': csrf_token, 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' }), data:{'name':'A name'}, dataType:'json' } const response = await fetch (url, defaults) When I debug I get an empty querydict in the request.POST What am I doing wrong? -
im trying to send authentication request for apple using python and django 1.9, but always giving me unsupported_grant_type
im trying to send authentication request for apple using python and django 1.9, but always giving me unsupported_grant_type def login_with_apple(self, code): apple_url = "https://appleid.apple.com/auth/token" client_secret = generate_apple_client_secret() adapter = AppleOAuth2Adapter(self.request) headers = {'content-type': 'application/x-www-form-urlencoded'} data = {'client_id': settings.CLIENT_ID, 'client_secret': client_secret, 'code': code, 'grand_type': 'authorization_code'} resp = requests.post(url=apple_url, data=data, headers=headers) access_token = None if resp.status_code in [200, 201]: try: access_token = resp.json() except ValueError: access_token = dict(parse_qsl(resp.text)) if not access_token or 'acces_token' not in access_token: raise OAuth2Error( 'Error retrieving access token: %s' % resp.content ) return access_token ** how i generates my client_secret** def generate_apple_client_secret(): now = datetime.utcnow() claims = { 'iss': settings.SOCIAL_AUTH_APPLE_TEAM_ID, 'aud': 'https://appleid.apple.com', 'iat': now, 'exp': now + timedelta(days=180), 'sub': settings.CLIENT_ID, } headers = {'kid': settings.SOCIAL_AUTH_APPLE_KEY_ID, 'alg': 'HS256'} client_secret = jwt.encode( payload=claims, key=settings.SOCIAL_AUTH_APPLE_PRIVATE_KEY, algorithm='HS256', **strong text** headers=headers).decode('utf-8') return client_secret ** im sending a request to apple but always giving me this error** user = self.login_with_apple(ser.instance.token) File "/home/omar/PycharmProjects/Aswaq/oscarapi/views/login.py", line 488, in login_with_apple Error retrieving access token: %s' % resp.content OAuth2Error: Error retrieving access token: {"error":"unsupported_grant_type"} -
Django how can I query only the records which exactly fullfill the filter condition in a Many-to-one condition
I have the following models: class McMbData(models.Model): lastname = models.CharField(max_length=50,blank=True) class Visits(models.Model): mcmbdata_id = models.ForeignKey(McMbData, on_delete=models.CASCADE) name = models.CharField(max_length=50,blank=True) signe_in = models.BooleanField(default=False) I only want to get the records of Visits where signe_in =True Here is what I have tried: McMbData.objects.filter(visits__signe_in = False) So I get all McMbData entries where the condition is fulfilled at least once: Lastname: Mutermann Visits: Bears,True - Renegade,False - Hollywood,False I only want to get the entries of visits which are true. Like this: Lastname: Mutermann Visits: Bears,True -
Response from Google Cloud Platform to Django app
I created a simple Django app and tested in the local server and it was working fine. The app is expected to work like, whenever a post request is received to the corresponding view, the response should be an audio file . In the local server it is working as expected and the response header is showing "'Content-Type': 'audio/mpeg'" but from the Google cloud I am not getting the audio file and the response header is showing the content type as "text/html". Django view if request.method == 'POST': data = request.FILES['file'] tmp = os.path.join(settings.MEDIA_ROOT, "Image", data.name) path = default_storage.save(tmp, ContentFile(data.read())) tmp_file = os.path.join(settings.MEDIA_ROOT, path) # ================ DATA PROCESSING ======================= # Image can be acced in :: tmp_file # ================ DATA PROCESSING - END ======================= fhandle = open("piZero/from_file.mp3", 'rb') # audio output file name tmp = os.path.join(settings.MEDIA_ROOT, "Audio", "output.mp3") path = default_storage.save(tmp, ContentFile(fhandle.read())) audioFile = os.path.join(settings.MEDIA_ROOT, path) # Response build response = HttpResponse() file_handle = open(audioFile, "rb") file = file_handle.read() file_handle.close() response['Content-Disposition'] = 'attachment; filename=filename.mp3' return HttpResponse(file, content_type="audio/mpeg") else: return HttpResponse("GET") app.yaml : since I don't have any static files I haven't run the collect static. In the actual program this audio file will be created from the program. So I … -
Reverse for 'add_review' with arguments '('',)' not found. 1 pattern(s) tried: ['addreview/(?P<id>[0-9]+)/$']
I am getting an error after i have added Review model in django... on admin page model is created but on my site it is not working.I don't know where i am going wrong ...please guide me Getting an error on line 28 of base.html Its also showing an error on views.py line 21 views.py from django.shortcuts import render, redirect from django.http import HttpResponse from .models import * from .forms import * # Create your views here. def home(request): allbooks= book.objects.all() context= { "books": allbooks, } return render(request,'main/index.html',context) #error line def detail (request,id): bk=book.objects.filter(id=id) reviews=Review.objects.filter(book=id) context ={ "book":bk, "reviews":reviews } return render (request,'main/details.html',context) def addBooks(request): if request.user.is_authenticated: if request.user.is_superuser: if request.method== "POST": form=BookForm (request.POST or None) if form.is_valid(): data=form.save(commit=False) data.save() return redirect("main:home") else: form=BookForm() return render (request, 'main/addbooks.html',{"form":form,"controller":"Add Books"}) else: return redirect("main:home") else: return redirect("accounts:login") def editBooks(request,id): if request.user.is_authenticated: if request.user.is_superuser: bk=book.objects.get(id=id) if request.method== "POST": form=BookForm (request.POST or None,instance=bk) if form.is_valid(): data=form.save(commit=False) data.save() return redirect("main:detail",id) else: form=BookForm(instance=bk) return render (request, 'main/addbooks.html',{"form":form,"controller":"Edit Books"}) else: return redirect("main:home") else: return redirect("accounts:login") def deleteBooks(request,id): if request.user.is_authenticated: if request.user.is_superuser: bk=book.objects.get(id=id) bk.delete() return redirect("main:home") else: return redirect("main:home") else: return redirect("accounts:login") def add_review(request,id): if request.user.is_authenticated: bk=book.objects.get(id=id) if request.method == "POST": form= ReviewForm(request.POST or None) if form.is_valid(): data=form.save(commit=False) … -
Django admin template css is not loaded when deploy it in Heroku?
this is the admin page deployed in heroku, enter image description here here is my settings.py STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/' deploy_settings.init.py DEBUG = False STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] I tried to run python manage.py collectstatic locally, and run it in heroku bash also, but it didn't work. Do we actually need to run this command? or staticfiles are collected when pushing to heroku master? I tried to add DEBUG_COLLECTSTATIC=1 in heroku config variables, but it doesn't work. one last note, I tried to install whitenoise and add it to the settings.py middlewars, and add STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' in deply_settings.init.py but I recieved this error, enter image description here when -
How to create self defined token in Django Token Auth
Can we create a self-defined token in the Token Auth in Django? Currently, we are creating a super-user and generating a token for that super-user. But there are several environments and we want to keep the token same for all environments. Hence, a self-defined token is needed. -
I Have 2 python files in a same directory i want to import one .py file from another .py file
self.txtok=Button(Login_Frame,text='SIGN-IN',font=('arial',15,'bold'),command=self.Login, height=2,width=10,bd=4,padx=2,pady=2,fg='yellow',bg='brown',) self.txtok.grid(row=4,column=0) def Login(self): if (self.uname.get()=="" or self.upass.get()==""): messagebox.showerror("Error","All the feild are requried") elif(self.uname.get()=="1" and self.upass.get()=="1"): self.root.destroy() import WarehouseInventory #messagebox.showerror("SuccessFull",f"welcome{self.uname.get()}") import WarehouseInventory elif(self.uname.get()=="s" and self.upass.get()=="1"): self.root.destroy() import CRUD [Directrories I cannot execute Import WarehouseInventory in 2nd elif ]1 -
Django-allauth Not sending html email on Signup but works perfectly on other times / for other process
I'm using Django-allauth to authenticate user and I'm successfully send HTML email. But problem is when user SIGNUP then verification email is txt file and when Verification email resend it goes of HTML email. Other times like password Reset, login HTML email works perfectly. Only problem is for new user at time of signup only..... Please help me out.. -
How to use django html template tags in react jsx?
I want to use react as a template engine in django. But i don't know how to use django template tags in react jsx Syntex. I searched the web but i got a very common answer the use django as a backend and make an api with django rest framework and use it in react as an api. But in this i have to run two servers, one for django and another one for react but i want to use both in a single server. For this i have to pass data from django backend to template, and for reflect the data on template i have to use django template tags. But in react i don't know how to do this. Any help plz.... -
Provide a specific folder in the media folder for the user to download
Consider that there are three models that are related: class User(AbstractUser): # Its fields class Event(models.Model) user = models.ForeignKey('User', on_delete=models.CASCADE) # other fields class Event_file(models.Model): event = models.ForeignKey('Event', on_delete=models.CASCADE) file = models.ImageField(upload_to='{1}/{2}'.format(self.event.user, self.event) So we will have this structure in the media folder: media User 1 event 1 (where there are several photos) event 2 (where there are several photos) event 3 (where there are several photos) User 2 event 1 (where there are several photos) child 2 (where there are several photos) How can I provide a button in the web page for each user to download their own folder (ie user folder)? Although the user folder may need to be zipped for download. Note: Folder contents are not fixed and may change over time. Thank you in advance -
how to login multiple user in same browser using django
I am create a application where admin and customer login same browser. I read many blog not able not fix my problem. As Django use session based login. I am facing issue while logout my admin then my customer automatic logout. maybe session based functionally My admin LoginView and Logoutview: class AdminLoginView(SuccessMessageMixin,LoginView): authentication_form = LoginForm template_name = 'login.html' redirect_field_name = reverse_lazy('admin_panel:dashboard') redirect_authenticated_user = False success_message = '%(username)s login Successfully !' def dispatch(self, *args, **kwargs): if self.request.user.is_authenticated: # messages.info(self.request, f"{self.request.user.firstname} is already Logged In") return redirect('/admin/dashboard/') return super().dispatch(*args, **kwargs) def get_success_url(self): url = self.get_redirect_url() LOGIN_REDIRECT_URL = reverse_lazy('admin_panel:dashboard') return url or resolve_url(LOGIN_REDIRECT_URL) class LogoutView(LogoutView): """ Log out the user and display the 'You are logged out' message. """ next_page = "/admin/login" def dispatch(self, request, *args, **kwargs): response = super().dispatch(request, *args, **kwargs) messages.add_message(request, messages.INFO,'Successfully logged out.') return response I have implemented customer based login & logout def LoginView(request): form = LoginForm(request.POST or None) if form.is_valid(): username = form.cleaned_data["username"] password = form.cleaned_data["password"] remember_me = form.cleaned_data["remember_me"] user = User.objects.get(email=username) if user and user.check_password(password): if user.is_active: if remember_me == False: request.session.set_expiry(0) request.session['user_id'] = user.id request.session['username'] = user.email return HttpResponseRedirect('/') else: context = {'auth_error': "You're account is disabled"} return render(request, 'forntend-signin.html', context ) else: context = { … -
Ways to add new row or update existing in a CSV without using mysql using Django / PHP
I have to add a new row or update existing row of a csv file from a webpage (In the form of AJAX table with crud operation ) without using MySQL or any other DB Table . once i add or update the row it should be updated in that CSV file . Is this possible to do in Django / PHP if yes , can anyone provide me the link so that i can refer Thanks