Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Implement Django Existing Signup View Function as New APICreateView using Django RestFramework
There's two view functions for user registration that I currently have. signup which creates a user and emails a token. activate which validates the token and activates the user. I would like to convert this into a restframework api. I also have a profile model for each user. Profile has a manytomany EmailField (users can add multiple emails after registration) so I also wanted to implement the token sent and activate functions for each email. def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.is_active = False user.save() current_site = get_current_site(request) mail_subject = 'Activate your account.' message = render_to_string('email/acc_active_email.html', { 'user': user, 'domain': current_site.domain, 'uid':urlsafe_base64_encode(force_bytes(user.pk)), 'token':account_activation_token.make_token(user), #returns token using user & timestamp }) to_email = form.cleaned_data.get('email') email = EmailMessage( mail_subject, message, to=[to_email] ) email.send() return HttpResponse('Please confirm your email address to complete the registration') else: form = SignupForm() return render(request, 'email/signup.html', {'form': form}) def activate(request, uidb64, token): try: uid = force_text(urlsafe_base64_decode(uidb64)) user = User.objects.get(pk=uid) except(TypeError, ValueError, OverflowError, User.DoesNotExist): user = None # account_activation_token.check_token() returns a bool if the token is valid if user is not None and account_activation_token.check_token(user, token): user.is_active = True user.save() login(request, user) # return redirect('home') return HttpResponse('Thank you for your email confirmation. … -
Django form value not changing in views
I am currently trying to set the value of a foreignKey in the views.py file, but it does not change. models.py class Item(models.Model): sht = models.ForeignKey(Sheet, on_delete=models.CASCADE, blank=True, null=True) name = models.CharField(max_length=100) amount = models.IntegerField(default=1) def __str__(self): return self.name views.py def addItem(request, slug): sheet = Sheet.objects.get(slug=slug) form = forms.AddItem() if request.user == sheet.author: if request.method == 'POST': form = forms.AddItem(request.POST) if form.is_valid(): form.save(commit=False) form.sht = Sheet.objects.get(slug=slug) # This is where it should change form.save() return redirect('sheets:detail', slug=slug) else: form = forms.AddItem() form.sht = Sheet.objects.get(slug=slug) return render(request, 'sheets/addItem.html', { 'form': form, 'slug': slug }) else: return redirect('sheets:list') After the form is saved, after looking in the admin console, the sht never changes and is still equal to blank. I have confirmed that there is a Sheet object when the views.py runs Sheet.objects.get(slug=slug). -
How can I update my UserProfile model when the User model is updated Django
I have a site where I need to update my UserProfileInfo model, which is how I am extending the User model. However, whenever I save the User model, the UserProfileInfo does not, meaning in the admin, the User model has the first_name and last_name variables filled out, however the UserProfileInfo does not. Here is some code. MODELS.PY class UserProfileInfo(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE,max_length=30) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) description = models.TextField(max_length=150) website = models.URLField(max_length=200,blank=True,null=True) image = ProcessedImageField(upload_to='profile_pics', processors=[ResizeToFill(150, 150)], default='default.jpg', format='JPEG', options={'quality': 60}) joined_date = models.DateTimeField(blank=True,null=True,default=timezone.now) verified = models.BooleanField(default=False) moderator = models.BooleanField(default=False) tags = TaggableManager() def __str__(self): return f'{self.user.username} Profile' def save(self, *args, **kwargs): super().save(*args, **kwargs) @receiver(post_save, sender=User) def create_or_update_user_profile(sender, instance, created, **kwargs): if created: UserProfileInfo.objects.create(user=instance) else: instance.userprofileinfo.save() In the receiver, I want to update both, but it is not. FORMS.PY class UserProfileInfoForms(UserCreationForm): email = forms.EmailField() class Meta(): model = User fields = ['username','first_name','last_name','email'] class UserUpdateForm(forms.ModelForm): email = forms.EmailField() class Meta: model = User fields = ['username','email'] class ProfileUpdateForm(forms.ModelForm): class Meta: model = UserProfileInfo fields = ['image','description','tags','website'] And finally here is the view VIEWS.PY @login_required def profile_update(request): if request.method == 'POST': u_form = UserUpdateForm(request.POST, instance=request.user) p_form = ProfileUpdateForm(request.POST, request.FILES, instance=request.user.userprofileinfo) if u_form.is_valid() and p_form.is_valid(): u_form.save() p_form.save() messages.success(request, f'Your account … -
Only allow filling one field or the other in Django model and admin
I've got a simple Django model for a Group that has a list of Contacts. Each group must have either a Primary contact ForeignKey or a All contacts BooleanField selected but not both and not none. class Group(models.Model): contacts = models.ManyToManyField(Contact) contact_primary = models.ForeignKey(Contact, related_name="contact_primary", null=True) all_contacts = models.BooleanField(null=True) How can I ensure that: The model can't be saved unless either contact_primary or all_contacts (but not both) is set. I guess that would be by implementing the Group.save() method? Or should it be the Group.clean() method?? In Django Admin either disable the other field when one is selected or at least provide a meaningful error message if both or none are set and the admin tries to save it? Thanks! -
How do I pass a slug to the URL in Django?
At this point I just want to call a page based on my table.html template. I'll work on adding all of my table data later. Presently, when I click on my link to a table on the index.html page I get a "TypeError... table() got an unexpected keyword argument 'd_100_id'. I've tried removing unnecessary code from the table view and template, and I checked in an incognito Chrome browser in case I'm getting the old page each time. My views.py page from django.shortcuts import get_object_or_404, render from .models import D100Generator def index(request): latest_table_list = D100Generator.objects.order_by('-d_100_id')[:5] context = { 'latest_table_list': latest_table_list } return render(request, 'generators/index.html', context) def table(request, table_slug): table = get_object_or_404(D100Generator, pk=table_slug) return render(request, 'generators/table.html', {'table': table}) My url.py (in case this helps): from . import views app_name = "generators" urlpatterns = [ path('', views.index, name='index'), path('table/<slug:d_100_id>', views.table, name='table'), ] index.html <br> <h2>Recent tables added include:</h2> {% if latest_table_list %} <ul> {% for table in latest_table_list %} <li><a href="/generators/table/{{ table.table_slug }}">{{ table.table_name }}</a></li> {% endfor %} </ul> {% else %} <p>No tables are available.</p> {% endif %} and table.html <h1>{{ table.table_name }}</h1> I wanted it to call at least the table.html page and display the table_name. What I got instead … -
Need very simple pubsub service between Django and Vue
Our application is a turn based, multi-player strategy game. In each turn, all the players plan their next move and then send it to the server. The application has a Vue frontend and Django backend. Frontend runs on Amazon S3 and backend on Elastic Beanstalk. The game must show when other players have completed their turn. For this, a simple pub/sub is needed. All players' Vue apps must subscribe to their own game's queue. When they send their next move to the backend over the REST API, the backend should push a notification to players in the game. Notification does not need to contain any data. It does not matter if the player who just completed her own turn also gets the notification. I have considered the following implementation options: Own RabbitMQ installation: this is what we are using now. Vue connects to RabbitMQ over webstomp. However, RabbitMQ is an overkill for this purpose and we do not want to host our own MQ server. Amazon MQ: Also, overkill, and only supports webstomp over TLS which makes the process more complex, if not impossible for the Vue app. Amazon SQS+SNS: might work but seems also very complex for this task. … -
Link Username To Post Created By User
I would like to link the user who created the post by their username that way people know who it was posted by but I can't seem to get it to work and yes I am logged in and I have a working register and login form already. Every time I go to submit some news from the form when logged in I get this error NOT NULL constraint failed: news_news.author_id models.py from django.db import models from django.contrib.auth.models import User from markdownx.models import MarkdownxField from markdownx.utils import markdownify from taggit.managers import TaggableManager class News(models.Model): author = models.ForeignKey(User, unique=True, on_delete=models.CASCADE) title = models.CharField(max_length=150) short_desc = models.CharField(max_length=500) content = MarkdownxField() tags = TaggableManager() slug = models.SlugField(unique=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.title views.py def show_news_view(request): news = News.objects.values('author', 'title', 'short_desc', 'tags', 'created_at', 'updated_at') context = { 'news': news } return render(request, "news/news_home.html", context) def new_news_form_view(request): if request.method == "POST": form = NewNewsForm(request.POST or None) if form.is_valid(): form.save() form = NewNewsForm() return redirect('/news') else: form = NewNewsForm() context = { 'form': form } return render(request, "news/news_form.html", context) -
How to store data that would require 1024 columns in a django model (relational db)?
I have a django app that will need to read/write data into a table (table doesn't exist yet). The data to be read/written consists of a 1024 vector of floats. It's really a 32x32 grayscale image rolled into a vector. (The vector represents a single entry) In this case, I'm assuming I need a table with 1024 +id columns. Is this the best practice for this type of situation? How to do that in django with the models? Will I need to create a class with 1024 atributes like this? class ImageData(models.Model): pixel_1 = models.DecimalField(max_digits=19, decimal_places=16) pixel_2 = models.DecimalField(max_digits=19, decimal_places=16) ... pixel_1024 = models.DecimalField(max_digits=19, decimal_places=16) -
I want to sell my project http://134.209.146.159 to anyone at ony cost
http://134.209.146.159 -----> AI-Based Movie Recommendation System I made this website that has a multitude of features and uses AI for the recommendation(Collaborative Filtering to be precise). I have made this project on Python 3.5 and Django 2.2.4 . The website is fully responsive. I have made it well enough to be sold out to anyone. I cant work on this project anymore but I think that someone here would be interested to buy it at a minimum of 15$. The website's price depends on you and is negotiable. You have complete rights to do whatever you want from this project after buying it. Please please share this as I want to sell it to someone. The chat feature can be tried by opening the website on 2 different tabs or on some other device like a smartphone. You don't even need to sign in to chat. Please go and check it out. In case you are not interested in buying it, it's okay. Please give me your valuable feedback. Did you like the website? Email: shubhastro2@gmail.com skype-id: live@shubhastro2 I am expecting to sell it as soon as possible. I hope that you are interested in this awesome deal. -
Trying to update a user profile in django
I don't get any error with this code, but when I update it nothing happens, I would love some help :) I have no idea what I'm doing. Models.py class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) portfolio_site = models.URLField(blank=True) profile_image = models.ImageField(upload_to='swap_me/profile_image',blank=True) def __str__(self): return self.user.username Forms.py class ProfileUpdateForm(forms.ModelForm): class Meta(): model = Profile fields = ("portfolio_site","profile_image") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["portfolio_site"].label = "Site" self.fields["profile_image"].label = "Image" Views.py @login_required def profile_update(request): user = request.user form = ProfileUpdateForm(request.POST or None, initial={'profile_image': user.profile.profile_image, 'portfolio_site': user.profile.portfolio_site}) if request.method == 'POST': if form.is_valid(): user.profile.profile_image = request.POST.get('profile_image') user.profile.portfolio_site = request.POST.get('portfolio_site') user.save() return HttpResponseRedirect(reverse('home')) else: print("Fist me daddy!") else: print(request.method) context = { "profile_updateform":form, } return render(request, 'profile.html', context) -
Is there any way to create pdf in django and embed csv/excel file in that pdf? My pdf will also contain chartjs plots
I need to generate pdfs from my django code. Is there any way to embed csv/excel file in my pdf? Since I have to add a lot of chartjs plots, I am thinking of using WKHTMLTOPDF so that I can convert my plots to images and add it on the pdfs. Please feel free to suggest other approaches as well. -
Django Saving Scraped File to Models
I'm trying to download and save a file using urllib and tempfile. The file is automatically downloaded when the url is opened. The problem I'm having is that the tempfile is not being saved to the models. models.py from __future__ import unicode_literals from django.db import migrations, models from django.core.files.temp import NamedTemporaryFile from django.core import files from django.core.files import File import datetime from django.utils.timezone import now import urllib.request import tempfile class News_Manager(models.Manager): def news(self,url): file_temp = NamedTemporaryFile(delete=True) file_temp.write(urllib.request.urlopen(url).read()) file_temp.flush() save = file_temp.name[1:] News.objects.create(site_file = File(save)) class News(models.Model): created_at = models.DateTimeField(auto_now_add=True,auto_now=False) site_file = models.FileField(upload_to='media') objects = News_Manager() I used save = file_temp.name[1:], because when using file_temp I got a django SuspiciousOperation: Attempted access to '/tmp/tmp71veejj0' denied How can I save this file to my model? Right now it creates a row with the created_at field, but the site_file field is empty(no file name). Also the file is not saved in the media directory. If I upload an image through Django admin it works. The file is saved in the media directory and the name appears in the database. How can I fix this? -
Error when i am try to install start gunicorn on digitalocean server Django
it's the first time i have deployment on digitalocean, and i have django project when i try to start gunicorn.service i got Error my gunicorn.service file [Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=mrsecured Group=www-data WorkingDirectory=/home/mrsecured/landingpage ExecStart=/home/mrsecured/landingpage/myprojectenv/bin/gunicorn \ --access-logfile - \ --workers 3 \ --bind unix:/run/gunicorn.sock \ landingpage.wsgi:application [Install] WantedBy=multi-user.target when i run sudo systemctl status gunicorn.socket i got this error Active: failed (Result: service-start-limit-hit) gunicorn.socket: Failed with result 'service-start-limit-hit when i run sudo systemctl status gunicorn i got this error gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2019-10-16 19:56:53 UTC; 12min ago Process: 24933 ExecStart=/home/mrsecured/landingpage/myprojectenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/gunic Main PID: 24933 (code=exited, status=203/EXEC) gunicorn.service: Main process exited, code=exited, status=203/EXEC gunicorn.service: Failed with result 'exit-code'. Started gunicorn daemon. gunicorn.service: Failed to execute command: No such file or directory gunicorn.service: Failed at step EXEC spawning /home/mrsecured/landingpage/ gunicorn.service: Main process exited, code=exited, status=203/EXEC gunicorn.service: Failed with result 'exit-code'. gunicorn.service: Start request repeated too quickly. gunicorn.service: Failed with result 'exit-code'. Failed to start gunicorn daemon. -
Regarding developing developing web applications using pythons
I am student of bca and I am trying to develop my project using python a complete web app and also I am a beginner to python. Without using any web frameworks is it possible to develop web app? which languages are need to be used as front end and back end? Please help me related to this.. Thank you☺ -
Django_tables2 ValueError: Expected table or queryset, not str
iam rendering django_tables2 table in a template using the {% render_table table %} but i am getting the error above. models.Py K tables.py ```import django_tables2 as tables from .models import issuekeys class issued_table(tables.Table): model=issuekeys template_name = "django_tables2/bootstrap.html" fields=('keynumber', 'workorder','contrator','assigned_name','assigned_contact','date_to_return',)``` views.py ``` def issuetable(): table = issued_table(issuekeys.objects.all()) RequestConfig(request, paginate={'per_page': 10}).configure(table) return render(request, "keymanagement.html", {'table': table})` `` kemanagement.html {% load widget_tweaks %} {% load bootstrap4 %} {% bootstrap_css %} {% bootstrap_javascript jquery='full' %} {% load i18n %} {% load render_table from django_tables2 %} <div class="col-4"> <h4 class="text-primary" style="text-align:left; font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif" >Register Key:</h4> <div class="row" style="margin-top: 1em; margin-left: 1mm"> {% render_table table %} </div> </div> ``` django_tables2 version: 2.1.1 django version: 2.2.6 kindly assist i dont know where am goin wrong -
Is there a way to get a CMake variable into a python file?
I have looked and cannot find anything on the topic. So far, the best option I have come up with, is to have a .in script which I can get the variables I need then append the variables I need to the end of a python file, then import those variables from that python file. This seems a bit extreme, and I was wondering if there is an easier way? The python file I need the CMake variable in, is used by django. Not sure if that will have any effect. -
How to setup data bases for development and production with decouple?
In my settings file, I'm using an ifelse statement to control what Data Base to use. I'm using: 1) Development: a local SQL data base. 2) Production: a PostgresSQL in production (project hosted in Heroku). What is the best approache to connect to each DataBase depending of if I'm working in development (local PC) or Production (deploying to Heroku)? Right now I'm using and ifelse condition, but I've to change DEBUG everytime I'm working locally. And sometimes I forgot to change this to false for production. settings.py: import os from decouple import config SECRET_KEY = config('SECRET_KEY') DEBUG = config('DEBUG', default=False, cast=bool) SECURITY WARNING: don't run with debug turned on in production! if DEBUG: # Redirecciona www y http a https SECURE_SSL_REDIRECT = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } else: # Redirecciona www y http a https SECURE_SSL_REDIRECT = True ### HEROKU POSTGRESS ACCESS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': config('HEROKU_POSTGRESQL_NAME'), 'USER': config('HEROKU_POSTGRESQL_USER'), 'PASSWORD': config('HEROKU_POSTGRESQL_PASSWORD'), 'HOST': config('HEROKU_POSTGRESQL_HOST'), 'PORT': config('HEROKU_POSTGRESQL_PORT'), } } Another option I've found recently is: Django-Split-Setting. I need to investigate this further. https://github.com/sobolevn/django-split-settings -
an employee who created the app left, how do we access the Heroku account as the app stopped working
an employee who created the app left, how do we access the Heroku account as the app stopped working an employee who created the app left, how do we access the Heroku account as the app stopped working an employee who created the app left, how do we access the Heroku account as the app stopped working -
How to avoid infinite recursion in self-referencing many-to-many relation
In order to implement a delegation system in my Django application, I have a self-referencing many-to-many relation on my person model: from django.contrib.auth.models import AbstractUser from django.db import models class Person(AbstractUser): delegates = models.ManyToManyField("self", symmetrical=False, blank=True, null=True, default=None) I believe there are two pitfalls (ways to trigger infinite recursions) to this approach: If User A set himself as delegate (probably dumb but feasible) If User A set User B as delegate and User B set User A as delegate What would be the right approach to avoid such cases? -
IntegrityError at /sheets/create/ NOT NULL constraint failed: sheets_sheet.sheetGroup_id
When filling out a form for my model, every field is filled in properly but then it breaks when I go to submit it. I have made migrations and migrated, as well as adding blank=True, null=True. models.py # There is a bunch of more fields, but this seems to be the field breaking it sheetGroup = models.ManyToManyField(SheetGroup, blank=True, null=True) forms.py class CreateSheet(forms.ModelForm): class Meta: model = models.Sheet fields = '__all__' views.py def createSheet(request): form = forms.CreateSheet() # for group in SheetGroup.objects.all().order_by('name'): # form.sheetGroup.add(group) if request.method == 'POST': form = forms.CreateSheet(request.POST) form.author = request.user if form.is_valid(): form.save() return redirect('sheets:list') else: form = forms.CreateSheet() return render(request, 'sheets/createSheet.html', { 'form': form }) This is the error message being given: https://ibb.co/JFF4pd3 whenever I submit the form (with every field being filled out properly). -
How to use conda and django-admin startproject properly in 2019
I would like to know the latest steps to use Django with Conda or if I should be using another anaconda tool altogether. My research has not shown me clear 2019 solutions to this. I have found this which appears to start launching the boilerplate code directory structure directly in the djangoenv. I may need this ironed out in my head, but I thought we use the creation of the environment separate from the code we wish to run with it. I have a MBP with Mojave 10.14.6 using VSCode and conda to manage my environments for Pyhton. I am a little confused on where I should be creating a directory structure with the manange.py and where I should be having an environment built from. I think the top level django application directory needs to be created with a mkdir and the resulting .env file should be frozen from within that structure by first creating a conda environment and installing django there, then using conda list --export to freeze the environment created. conda create --name django-app python=3.7.4 conda activate django-app # installs to the ## Package Plan ## environment location: /Users/me/anaconda3/envs/django-app conda install django ## Package Plan ## environment location: … -
How to serve Django static files during development without having to run "collectstatic"?
I have a Django version 2.2.6 application that has my Django static files being served up from a separate dedicated file server. I use the Django "collectstatic" command to update the static files on my file server whenever one of them changes. I also use the django-pipeline package so that each static file contains a special string in the file name. This prevents my users' browsers from loading a static file from cache if I've updated that file. This configuration works perfectly. I'm now in a phase in which I'm making constant changes to my CSS file to create a new look and feel to my website and it's a pain to have to remember to run the collectstatic command after each little change I make. Is there a way I can temporarily "toggle" this collectstatic configuration off while I'm doing development so that I don't have to constantly run the collectstatic command? I seem to recall there was a way to change the main urls.py file and set DEBUG = True to do something like this back in Django 1.8 but I don't see it mentioned in the latest Django documentation. What is the current "best practice" for doing … -
Django full text search: how to combine multiple queries and vectors?
I have a from with three inputs: category, location, and keywords. If all three fields are filled in the form, the relationship of the results should be AND, and otherwise will only fetch results by location. I have been trying to combine these three inputs for Django full-text search but it fetches results matching the location only. Here is my code for views.py: class SearchServices(generic.ListView): model = Service context_object_name = 'services' template_name = 'services/search.html' def get_queryset(self): qs = Service.objects if self.request.GET['location'] != '': lat_long = self.request.GET['location'].split(',') user_location = Point(float(lat_long[1]), float(lat_long[0]), srid=4326) keywords = self.request.GET['keywords'] category = self.request.GET['category'] query = SearchQuery(keywords) & SearchQuery(category) vector = SearchVector('title', 'description', StringAgg('tag__name', delimiter=' ')) + SearchVector(StringAgg('category__slug', delimiter=' ')) if self.request.GET['location'] != '': qs = qs.filter(location__distance_lte=(user_location, D(km=2))) if category != '': qs = qs.annotate(search=vector).filter(search=query).distinct() qs = qs.annotate(rank=SearchRank(vector, query)).order_by('-rank') qs = qs.annotate(distance=Distance('location', user_location)).order_by('distance') return qs Any pointers as to what I am doing wrong here would be highly appreciated. -
How to save Document in django?
\html <form> <table> <td colspan="2" style="text-align: center;"><h2 style="font-weight: bold;">Document</h2></td> </tr>{% for d in doc %} <tr> <td><p style="text-transform: capitalize;">{{d.Description}}</p></td> <td><input type="file" name="file" value="{{d.id}}"/></td> </tr> {% endfor %} </table> <input type=submit value="Submit" class="enroll w3-button w3-white w3-border w3-border-green w3-round-large w3-hover-green"> </form> \views def newEnroll(request): id = request.POST.get('ids') studentname = StudentProfile(id=id) doc = request.POST.get('file') document = DocumentRequirement(Description=doc) insert_doc = StudentsSubmittedDocument( Remarks = document ) insert_doc.save() \models class DocumentRequirement(models.Model): Description = models.CharField(max_length=500,blank=True) class StudentsSubmittedDocument(models.Model): Students_Enrollment_Records = models.ForeignKey(StudentsEnrollmentRecord, on_delete=models.CASCADE,blank=True,null=True) Document_Requirements = models.IntegerField(null=True,blank=True) Document = models.FileField(upload_to='files/%Y/%m/%d',null=True,blank=True) Remarks = models.CharField(max_length=500,blank=True,null=True) class StudentsEnrollmentRecord(models.Model): Student_Users = models.ForeignKey(StudentProfile, related_name='+', on_delete=models.CASCADE,null=True) School_Year = models.ForeignKey(SchoolYear, related_name='+', on_delete=models.CASCADE, null=True, blank=True) i have 3 models that I combine in views, i just want to save an document on every StudentsSubmittedDocument(Students_Enrollment_Records), "DocumentRequirement(Document)", please help me on these problem. no error detected but no data save in the database. -
How to access fields from this complex query-set given below?
I want to fetch fields from this queryset but basic slicing operation didn't work. [{"model": "core.userdetails", "pk": 1, "fields": {"username": "uposia", "first_name": "Uday", "last_name": "Posia", "password": "12345", "avatar": "IMG_4347_HGdzPIG.jpg", "about": "Python Django Developer", "slogan": "Live Young, Live Free"}}]