Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I'm having error in heroku while deploying my Djnago+Vuejs project
I'm trying to deploy my app in heroku through github. I have added whitenoise and gunicorn. It runs fine on my server. What could be the reason? I want the staticfiles in my project... It tells it failed to find my Vue dist folder. Also one more issue is my folder "frontend" is untracked in git. It is not adding even after I tried running "git add ." This is the error I'm getting: -----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app -----> Python app detected -----> Using Python version specified in runtime.txt -----> Installing python-3.10.5 -----> Installing pip 22.1.2, setuptools 60.10.0 and wheel 0.37.1 -----> Installing SQLite3 -----> Installing requirements with pip Collecting asgiref==3.5.2 Downloading asgiref-3.5.2-py3-none-any.whl (22 kB) Collecting certifi==2022.6.15 Downloading certifi-2022.6.15-py3-none-any.whl (160 kB) Collecting cffi==1.15.1 Downloading cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB) Collecting charset-normalizer==2.1.0 Downloading charset_normalizer-2.1.0-py3-none-any.whl (39 kB) Collecting confusable-homoglyphs==3.2.0 Downloading confusable_homoglyphs-3.2.0-py2.py3-none-any.whl (141 kB) Collecting cryptography==37.0.4 Downloading cryptography-37.0.4-cp36-abi3-manylinux_2_24_x86_64.whl (4.1 MB) Collecting defusedxml==0.7.1 Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB) Collecting dj-database-url==0.5.0 Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB) Collecting Django==3.2.10 Downloading Django-3.2.10-py3-none-any.whl (7.9 MB) Collecting django-allauth==0.51.0 Downloading django-allauth-0.51.0.tar.gz (709 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Collecting django-crispy-forms==1.14.0 Downloading django_crispy_forms-1.14.0-py3-none-any.whl (133 kB) Collecting django-extensions==3.2.0 Downloading … -
Django custom tags validation
I'm getting this error -> Invalid filter: 'cutter' while this is my custom tags.py: from django import template from random import randint register = template.Library() def cutter(list, args): return list[args] register.filter('cutter', cutter) a short part of index.html: {% extends 'main.html' %} {% load custom_tags %} {% load humanize %} {% load static %} {% block title %}main{% endblock title %} {% block home %}active{% endblock home %} {% block body %} <span>{{regions_count|cutter:forloop.counter0}}</span> {% endblock body %} -
Adding a value only once in a ManytoMany field across the table
I have a many-to-many field called paper in a model called Issues. Each Issues record shall have a list of papers. But the paper should be unique across the issue table. In other words, a paper that is added once to Issues should not be able to be added in any other record of the Issues table. How do i achieve it? class Papers(models.Model): ''' All the published papers ''' title = models.CharField(max_length=300) # title def __str__(self): return self.title class Issues(models.Model): ''' All issues ''' number = models.SmallIntegerField() # issue number paper = models.ManyToManyField('Papers') def __str__(self): return str(self.number) -
I got a query error when calling the user login in django
views.py from .models import Profile @login_required(login_url='/signin') def settings(request): user_profile=Profile.objects.get(user=request.user) return render(request,'setting.html',{'user_profile':user_profile}) I think the error is in :user_profile=Profile.objects.get(user=request.user) but I don't know why models.py from django.contrib.auth.models import User from django.db import models class Profile(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) id_user = models.IntegerField() bio = models.TextField(blank=True) profileimg = models.ImageField(upload_to='profile_pics/', default='default-profile.png') location = models.CharField(max_length=300, blank=True) birth_date = models.DateField(null=True, blank=True) ERROR -
I am unable to import css and js files from statcfiles in root directory
I have tried everything suggested on the entire internet and stuck here for over 5 days Here are my settings.py STATIC_URL = '/static/' # Add these new lines STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') I have a staticfile directory, i created with python manage.py collectstatic and I have all my css in that file here are my urls from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', include('accounts.urls')), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) Here are my app urls from django.urls import path from accounts.views import * from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('', SignUpView.as_view(), name='signup'), path('otp/', OTPView.as_view(), name='otp'), path('login/', LoginView.as_view(), name='login'), path('home/<int:id>', HomeView.as_view(), name="home"), path('logout/', UserLogout.as_view(), name="logout"), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) and here is my template base.html that I am inheriting in every other template {% csrf_token %} {% load crispy_forms_tags %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/User_Authentication/staticfiles/admin/css/responsive.css"> </head> I am getting this error Not Found: /User_Authentication/staticfiles/admin/css/responsive.css [11/Jul/2022 12:05:51] "GET /User_Authentication/staticfiles/admin/css/responsive.css HTTP/1.1" 404 4211 Not Found: /User_Authentication/staticfiles/admin/css/responsive.css … -
Is it possible to define examples for individual `Model` or `Serializer` fields with DRF-Spectacular?
I use DRF-Spectacular to generate the OpenAPI specification for my DRF-based API. So far, I do not add examples but instead rely on SwaggerUI to show examples based on the type and regex patterns. However, in same cases, I would like to add examples directly to the openapi.yml file. I would like to define examples for individual Model or Serializer fields, similar to generating descriptions based on the help_text parameters. Unfortunately, so far I've only found ways to defining complete examples for views and serializers based on OpenApiExample with extend_schema and extend_schema_serializer, respectively. This leads me to my question: Is it possible to define examples for individual Model or Serializer fields with DRF-Spectacular and, if yes, how? -
How can I get the average of 5 grades of User? Django
I am making a movie evaluation site using Djnago. This site allows each user to comment on a movie. At that time, I will give a 5-grade rating. How can I get the average of the 5-grade ratings of all users who commented on the movie? Below is a model of the comment. from datetime import datetime from accounts.models import CustomUser from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models # Create your models here. class Comment(models.Model): comment = models.TextField(max_length=1000) stars = models.FloatField(blank=False,null=False,default=0, validators=[MinValueValidator(0.0), MaxValueValidator(5.0)]) user = models.OneToOneField(CustomUser, on_delete=models.CASCADE,) movie_id = models.IntegerField() created_at = models.DateTimeField(default=datetime.now) updated_at = models.DateTimeField(auto_now=True) -
Django print all permissions of a users in template
I am editing the user permissions in templates. And I want to display checked checkbox if user has permissions or unchecked if user has not specific permissions. My View.py codes are as below. def EditUserView(request,id=0): user = User.objects.get(pk=id) permission = Permission.objects.all() return render(request,'edituser.html',{"userdata":user,"permissions":permission}) And My templates code are as given below. <div class="table-wrapper"> <table class="table"> <thead> <tr> <th>Permissions</th> <th>Status</th> </tr> </thead> <tbody> {% for perm in permissions%} <tr> <td id="perm">{{perm}}</td> <td><input type="checkbox" name="status" id="status" onclick="ChangeUserPermissions(this,userid='{{userdata.id}}',permission='{{perm}}')"></td> </tr> {% endfor %} </tbody> </table> </div> My objectives of the code is only display checked checkbox if have permissions or unchecked if not have permissions -
openCv Can't convert object of type 'JpegImageFile' to 'str' for 'filename'
from PIL import Image import numpy as np def save(self, *args, **kwargs): # open image pil_img = Image.open(self.pic) # convert the image to array and do some processing cv_img = np.array(pil_img) img = main(pil_img) # convert back to pil image im_pil = Image.fromarray(img) # save buffer = BytesIO() im_pil.save(buffer, format='png') image_png = buffer.getvalue() self.pic.save(str(self.pic), ContentFile(image_png), save=False) super().save(*args, **kwargs) can't understand what's wrong with it. i even tried to comment the cv_img = np.array(pil_img) but it still fail to run -
Why is my Django URL not linked to user ID?
When I enter the following URL: 'http://127.0.0.1:8000/mainpage/13/updateportfolio/', the rendered template shows 'Welcome username#13' on the top right which corresponds to the id #13 on my PostgreSQL database. '13' on the url However, if I type the URL 'http://127.0.0.1:8000/mainpage/100/updateportfolio/, the rendered template still shows the same username on the top right, it should redirect the user to the login page. How do I produce this authentication or am I having the wrong concept about URLs in general? '100' on the url urls.py app_name = 'mainpage' urlpatterns = [ path('<int:pk>/updateportfolio/', mainview.UpdatePortfolioView.as_view(), name='update'), path('<int:pk>/transactions/'), mainview.TransactionsView.as_view(), name='transactions'), ] views.py class UpdatePortfolioView(LoginRequiredMixin, FormView): form_class = UpdatePortfolio template_name = 'mainpage/updateportfolio.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) current_user = get_object_or_404(User, pk=self.request.user.pk) tickers = TickerSymbols.objects.all() context['username'] = current_user.username context['form'] = self.form_class context['tickers'] = tickers return context def get_object(self): return self.request.user.pk def form_valid(self, form): user_holding = get_object_or_404(Transaction, pk=self.request.user.pk) symbol = form.cleaned_data['symbol'].upper() share_number = form.cleaned_data['share'] user_holding.symbol = symbol # Save form inputs to database messages.success( self.request, f"{share_number} shares of {symbol} has been updated to your portfolio") # Save form super(UpdatePortfolioView, self).form_valid(form) if 'submit' in self.request.POST: return redirect(reverse('mainpage:transactions', kwargs={'pk': self.request.user.pk})) elif 'submit_another' in self.request.POST: return render(self.request, self.template_name, {'form': form}) -
How can I display pictures saved in a database?
This is my models file. I tried checking if there's a method for displaying class objects as a non-string.... Is there anything like that? class Images(models.Model): # height = models.PositiveIntegerField() # width=models.PositiveIntegerField() file=models.ImageField(upload_to='images/') #height_field='height', width_field = 'width # file = models.ImageField(#upload_to=user_directory_path, # width_field=100, height_field=100, blank=True, null=True) name = models.CharField(max_length=30) description = models.TextField(help_text="Give a short description of the image", max_length=100) def __str__(self): return self.name This the html file h1>This is the House Page</h1> {%for pic in pic%} {{pic}} {% comment %} <img src="{{pic}}" alt=""> {% endcomment %} {%endfor%} This is the view for the above html page def House(request): pic = Images.objects.all() return render(request, 'house.html', {'pic': pic}) This is the form that saves the picture <h1>Upload Your Image Here</h1> <form action="" method="POST" enctype="multipart/form-data"> <!--To allow images--> {% csrf_token %} {{form.as_p}} <br><br> <input type="submit" value="Submit"> </form> And this is the view for the above html page def imgUpload(request): form = ImageForm if request.method == 'POST': file = request.POST['file'] name = request.POST['name'] description = request.POST['description'] form = ImageForm(request.POST, request.FILES) pic = Images.objects.create(file=file, name=name, description=description) pic.save() return render(request, 'house.html', {'pic': pic}) #return HttpResponseRedirect('/fileupload.html?submitted=True') else: return render(request, 'fileupload.html',{'form': form}) -
How to get Payload from Form Data on Django?
I am struggling for a while to make a GET request to a website through , the problem is I am trying to get this data but I cannot access it, what is the best way to get the Payload > Form Data? Also using I have to use "CSRF Token exempt decorator" (which one It does not work) and also "CSRFViewMiddleware" I cannot deactivate (The thing is meanwhile I am using href and not deactivating it, It retrieves "CSRF token invalid or missing" error. Thank you -
Getting ID instead of Name in list
I am doing CRUD project with foreign keys and I am using serializers.I want to get the Name of the categories,sub categories,color and size instead of thier IDs models are: class Products(models.Model): categories = models.ForeignKey(Categories,on_delete=models.CASCADE) sub_categories = models.ForeignKey(SUBCategories,on_delete=models.CASCADE) color = models.ForeignKey(Colors,on_delete=models.CASCADE) size = models.ForeignKey(Size,on_delete=models.CASCADE) # image = models.ImageField(upload_to = 'media/',width_field=None,height_field=None,null=True) title = models.CharField(max_length=50) price = models.CharField(max_length=10) sku_number = models.CharField(max_length=10) product_details = models.CharField(max_length=300) quantity = models.IntegerField(default=0) isactive = models.BooleanField(default=True) class Categories(models.Model): #made changes to category_name for null and blank category_name = models.CharField(max_length=20) category_description = models.CharField(max_length=20) isactive = models.BooleanField(default=True) class Colors(models.Model): color_name = models.CharField(max_length=10) color_description = models.CharField(max_length=10) isactive = models.BooleanField(default=True) class Size(models.Model): size_name = models.CharField(max_length=10) size_description = models.CharField(max_length=20) isactive = models.BooleanField(default=True) class SUBCategories(models.Model): category_name = models.ForeignKey(Categories, on_delete=models.CASCADE) sub_categories_name = models.CharField(max_length=20) sub_categories_description = models.CharField(max_length=20) isactive = models.BooleanField(default=True) <td>Categories</td> <td> <select name="categories" id=""> {% for c in context %} <option value="{{c.id}}">{{c.category_name}}</option> {% endfor %} </select> </td> <td>Sub-Categories</td> <td> <select name="sub_categories" id=""> {% for c in sub_context %} <option value="{{c.id}}">{{c.sub_categories_name}}</option> {% endfor %} </select> </td> <td>Colors</td> <td> <select name="color" id=""> {% for c in color_context %} <option value="{{c.id}}">{{c.color_name}}</option> {% endfor %} </select> </td> <td>Size</td> <td> <select name="size" id=""> {% for c in size_context %} <option value="{{c.id}}">{{c.size_name}}</option> {% endfor %} </select> </td> below is the insert … -
How will I add css with Django Ckeditor?
I used django-ckeditor, It's working perfectly. But problem is, I couldn't add CSS. Even it ruined the template design. Even jQuery also not working in template. Now how can I fix these issues? forms.py: from django import forms from .models import Products from django.forms import ModelForm from ckeditor.fields import RichTextField class add_product_info(forms.ModelForm): product_desc = RichTextField() class Meta: model = Products fields = ('product_desc') labels = { 'product_desc':'Description', } widgets = { 'product_desc':forms.Textarea(attrs={'class':'form-control', 'style':'font-size:13px;'}), } templates: <form action="" method="POST" class="needs-validation" style="font-size: 13px;" novalidate="" autocomplete="off" enctype="multipart/form-data"> {% csrf_token %} {{form.media}} {{ form.as_p }} <div class="d-flex align-items-center"> <button type="submit" class="btn btn-outline-dark ms-auto" style="font-size:13px;">Add</button> </div> </form> and: <p class="item_desc_container text-center text-md-center text-lg-start descriptions poppins_font" style="font-size: 15px;"> {{ quick_view.product_desc|safe }} </p> -
MultipleObjectsReturned - get() returned more than one User -- it returned 2
views.py def message(request): username = request.GET.get('username') user = User.objects.get() return render(request,'member/message.html',{ 'username':username, 'user' : user }) if User.objects.filter(name=user).exists(): return redirect('/'+user+'/?username='+username) else: new_user = User.objects.create(name=user) new_user.save() return redirect('/'+user+'/?username='+username) def send(request): message = request.POST['message'] username = request.POST['username'] new_message = Message.objects.create(value=message,user=username) new_message.save() return HttpResponse('Message sent successfully') def getMessages(request,user): user = User.objects.get() messages = Message.objects.filter() return JsonResponse({"messages":list(messages.values())}) models.py class Message(models.Model): value = models.CharField(max_length=10000000) date = models.DateTimeField(default=datetime.now, blank=True) user = models.CharField(max_length=1000000) -
How to write character field in foreign key
I am creating a model with the name of area_model and in there I am taking foreign key of another model How to write field name as character field Class area_model(models,Model) Area_Name=model.ForeginKey(Group_Model,on_delete=models.CASCADE) How to write Area_Name in charfield -
sh: 1: Syntax error: Unterminated quoted string\n
I am making an online judge in django frame work I am trying to run a c++ program inside a docker container through subprocess. This is the line where I am getting error x=subprocess.run('docker exec oj-cpp sh -c \'echo "{}" | ./a.out \''.format(problem_testcase.input),capture_output=True,shell=True) here oj-cpp is my docker container name and problem_testcase.input is input for the c++ file C++ code: #include <bits/stdc++.h> using namespace std; int main() { int t; while (t--) { int a, b; cin >> a >> b; cout << a + b << endl; } return 0; } problem_testcase.input: 2 4 5 3 5 error: CompletedProcess(args='docker exec oj-cpp sh -c \'echo "2\n4\n5\n3\n5" | ./output\'', returncode=2, stdout=b'', stderr=b'2: 1: Syntax error: Unterminated quoted string\n') I am not getting what's wrong is in my code -
[Python/Django]How to know source of logs in console
I am currently working on configuring logging in Django and Python. In my django settings.py I configured LOGGING like below. # settings.py LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse', }, 'require_debug_true': { '()': 'django.utils.log.RequireDebugTrue', }, }, 'formatters': { 'verbose': { '()': 'django.utils.log.ServerFormatter', 'format': '[{name}][{levelname}][{server_time}] {message}', 'style': '{', }, 'test': { 'format': '[{name}][{server_time}] {message}', 'style': '{', }, }, 'handlers': { 'console': { 'level': 'INFO', 'filters': ['require_debug_false'], 'class': 'logging.StreamHandler', }, 'django.server': { 'level': 'INFO', 'class': 'logging.StreamHandler', 'formatter': 'verbose', }, }, 'loggers': { 'django.server': { 'handlers': ['django.server'], 'level': 'INFO', 'propagate': False, }, }, } If I send a request for test, I got this logs. Bad Request: /visit/timetable/ [WARNING][11/Jul/2022 14:18:49] "POST /visit/timetable/ HTTP/1.1" 400 41 What I want is remove this log Bad Request: /visit/timetable/ To remove unwanted logs, I need to know a source of logs. How can I make all logs to display "the source"? -
Django template: How to use variables in an {% if x == y %} statement?
In a Djgano template I want to include a {% if x == y %} statement where both x and y are variables as follows: <title>Category: {{category_id}}</title> <select name="category_id"> {% for category in categories %} <option value="{{category.id}}" {% if category.id is category_id %} selected {% endif %}>{{category.id}} : {{category.name}}</option> {% endfor %} The {{category_id}} variable is set and in the context. It displays correctly if places outside of the {% if %}, but inside the {% if %} bracket does not work. {% if category.id == category_id %} does not work. I assume that in this case category_id is simply read as a non-variable. {% if category.id is {{category_id}} %} {% if category.id == {{category_id}} %} Gives an error: "Could not parse the remainder: '{{category_id}}' from '{{category_id}}'" {% if category.id is category.id %} Works, of course, but of course that means that everything in the loop will become "selected". -
How to make CSS file from Vue work in Django?
I ran npm run build and then python manage.py collectstatic, but when I opened the Django server, the CSS got lost. One thing I noticed was that after build the css file wasn't stored as bundle.css in dist, rather, enter image description here So, I am confused how t specify this in vue.config.js file Here it is... enter image description here -
Cross domain cookie (sessionid, csrf token) with React after deployed Django backend server to AWS EC2
I have Django&React project. Problem is that as Login Authentication use session cookie, but browser is not set sessionid and csrf token in cookie. //React const API = "https://{my-aws-ec2-PublicIP}:8000/api/v1"; //Django //AWS_EC2_DEV_HOST is the variable set my aws ec2 public ip SESSION_COOKIE_AGE = 1209600 # Default: 1209600 (2 weeks, in seconds) SESSION_COOKIE_DOMAIN = AWS_EC2_DEV_HOST //SESSION_COOKIE_DOMAIN = 'https://127.0.0.1' SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_SECURE = True SESSION_COOKIE_SAMESITE = None CSRF_COOKIE_DOMAIN = AWS_EC2_DEV_HOST //CSRF_COOKIE_DOMAIN = 'https://127.0.0.1' CSRF_COOKIE_HTTPONLY = True CSRF_COOKIE_SECURE = True CSRF_COOKIE_SAMESITE = None Any problems? or Do i must have domain? Everything is fine in localhost. -
Error when create django application on pycharm
Few days ago I installed pycharm, then I create Django project and got error at step general...: Error creating Django application... I use: - python 3.8 - pycharm 2022.1.3 (pro version) - archlinux (kernel 5.15.53-1-lts) - i3 version 4.20 - xorg-server version 21.1.3 Any idea to fix this error? Thanks. -
JSON file of Accesss_token save in my db?
at firts i use java script, python, django and Maria DB. I want to save the information logged in with sns in the DB. enter image description here this is Kakao talk's login code. enter image description here I want to save the underlined information in my DB. enter image description here Code indicating the message window of the second photo. I want to know how to extract and save the JSON file of Accesss_token and save in my db -
How do make some computation on my POST request data in Django?
I am trying to send a POST request to my Django backend ie djangorestframework, rest api, and I am trying to get the data from this request and make some computation and send it back to the client. I get this error: File "/Users/lambdainsphere/seminar/backend/seminar/api/evaluator.py", line 12, in evaluate operand, op, operand2 = exp ValueError: too many values to unpack (expected 3) Here's my view: @api_view(['POST']) def compute_linear_algebra_expression(request): """ Given a Linear Algebra expression this view evaluates it. @param request: Http POST request @return: linear algbera expression """ serializer = LinearAlgebraSerializer(data=request.data) if serializer.is_valid(): serializer.save() data = serializer.data algebra_expr = data['expression'] #algebra_expr = tuple(algebra_expr) print(algebra_expr) algebra_expr = evaluate(algebra_expr) return Response({"expression":algebra_expr}, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) here is my evaluator: it consumes a python3 tuple: def evaluate(exp): """ Evaluate a Linea Algebra expression. """ operand, op, operand2 = exp if isinstance(operand, Vec) and op == '+' and isinstance(operand2, Vec): return operand + operand2 elif isinstance(operand, Vec) and op == '-' and isinstance(operand2, Vec): return operand - operand2 elif isinstance(operand, Vec) and op == '*' and isinstance(operand2, Vec): return operand * operand2 elif isinstance(operand, Vec) and op == '*' and isinstance(operand2, int): return operand * operand2 elif isinstance(operand, Matrix) and op == '+' and isinstance(operand2, … -
django-import-export exclude cannot work with a `fields.Field(ForeignKeyWidget(...`
I want name field be a description in export file, don't import it if it exists. But it always find instances with name and got a return more than 2 error. class Employee(models.Model): name = models.CharField(max_length=180, null=True, blank=True) id_number = models.CharField(max_length=180, null=True, blank=True, unique=True) class EmployeeFootprint(models.Model): rcsp = models.CharField(max_length=180, null=True, blank=True) employee = models.ForeignKey(Employee, on_delete=models.CASCADE, null=True, blank=True) class EmployeeFootprintResource(resources.ModelResource): employee = fields.Field(column_name='id_number', attribute='employee', widget=ForeignKeyWidget(models.Employee, 'id_number')) name = fields.Field(column_name='name', attribute='employee', widget=ForeignKeyWidget(models.Employee, 'name')) class Meta: model = models.EmployeeFootprint exclude = ['id', 'name'] import_id_fields = ['employee', 'rcsp']