Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can I create object day by day in Django?
I have just begin the Django web framework and I am trying to make internship diary application. I want to create an model which has name as "RecordedWorkDay" automatically for each intern user. But these object should be created by program for each day. What I mean is if today is Monday, tomorrow new object should be created by program. #That is my user class which extends from AbstractUser class CustomizedUser(AbstractUser): authory_choices = ( ("İntern", "İntern"), ("Manager", "Manager"), ) authory = models.CharField(choices=authory_choices, default="İntern", max_length=10) school = models.CharField(max_length=200, default='') description = models.CharField(max_length=100, default='') city = models.CharField(max_length=100, default='') def is_intern(self): if self.authory == "İntern": return True return False def is_manager(self): if self.authory == "Manager": return True return False #This class should save diary text for each day class RecordedWorkDays(models.Model): # TextField that holds users' working day records record = models.TextField() #Corresponding intern that owns this day object assignedIntern = models.ForeignKey(CustomizedUser, related_name="assigned", null=True, blank=True, on_delete=models.SET_NULL) creation_date = models.DateTimeField(default=datetime.now) -
Email the contents of saved record in django
How can I retrieve content of the object and send as an email notification ''' django ''' def submit_outages(request): upload_data = upload_data_form(request.POST) print(upload_data) request.session['info'] = {} data_to_submit = request.session['info'] if not data_to_submit: turb = unit_details.objects.filter( unit_name=request.POST['turbine']).first() print(type(turb)) # if upload_data.is_valid(): start_timestamp = request.POST['start_timestamp'] end_timestamp = request.POST['end_timestamp'] availability_type = request.POST['availability_type'] capacity_kw = request.POST['capacity_kw'] capacity_perc = (request.POST['capacity_perc']) outage_info = planned_outages( start_timestamp=start_timestamp, end_timestamp=end_timestamp, unit_id=turb, availability_type=availability_type, capacity_kw=capacity_kw ) outage_info.save() # send_mail(subject, message, from_email, to_list, fail_silently =True) subject = 'Outage Submitted' messages= "This should contain form data and unit_name from unit_details table" from_email = settings.EMAIL_HOST_USER to_list = [''] send_mail(subject,messages,from_email,to_list,fail_silently=True) print("*** upload_data ***") return redirect('get_outages') Subject - Outage Submitted Message - unit_name; start_timestamp ; end_timestamp ;capacity_kw ; -
TypeError: 'str' object is not a mapping in django urls template
I have an issues with urls in django which it was not there before in all other projects that i have done and suddenly in new django project this problem pops up. url.py urlpatterns = [ path('',views.Home.as_view(),name='home'), ] Html template <a class="nav-link" href="{% url 'home' %}"> console error: {**defaults, **url_pattern.default_kwargs}, TypeError: 'str' object is not a mapping in debug page: TypeError at / 'str' object is not a mapping Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.1 Exception Type: TypeError Exception Value: 'str' object is not a mapping Games -
in django admin model listing, Display 'Yes/No' for method's return value
I am learning django admin on dJango project site, and I want to display 'Yes/No' instead of True/False icons in admin listing page. These values come from a method defined in AdminModel. There is a method in a model class that returns True/False. in django there is an attribute "boolean", when assigned "True", it show red & green icons for column on admin listing page. **class** Question(models.Model): pub_date = models.DateTimeField('date published') def was_published_recently(self): now = timezone.now() **return** now - datetime.timedelta(days=1) <= self.pub_date <= now was_published_recently.boolean = True -
how to use multi select in django forms
I just want to use multiselect dropdown using django forms I have tried but simple multichecklist is comming class Hotel(models.Model): # COUNTRY =( # ('INDIA','INDIA'), # ('sri','sri'), # ('pak','pak') # ) hotel_Main_Img = models.ImageField(upload_to='images/') # geo = MultiSelectField(choices = COUNTRY,null =True,blank=True) geo = models.ForeignKey(Geo, on_delete=models.CASCADE, null=True, blank=True) genre = models.ForeignKey(Genre,on_delete=models.CASCADE,null=True, blank=True) free_tag = models.ForeignKey(FreeTag,on_delete=models.CASCADE,null=True, blank=True) default = models.ForeignKey(Default,on_delete=models.CASCADE,null=True, blank=True) for forms.py class HotelForm(forms.ModelForm): geo = forms.ModelMultipleChoiceField(queryset=Hotel.objects.all(), widget=forms.CheckboxSelectMultiple) class Meta: model = Hotel fields = '__all__' -
Nginx 500 (internal server) error Django and Gunicron?
I have a Django app deployed on an ubuntu machine with Nginx and gunicorn. The app was working until I made some changes in the code and pushed the changes to Github and pulled it on the server and now it returns this error. the code works on my machine but on the server doesn't work, I tried rechecking the libraries and installing them and restarting both nginx and gunicron. I even checked the logs and errors of nginx and gunicorn but nothing suspicious. The changes I made was adding a python file to process some user input if this piece of information could help. -
how to resolve mysql connection errors with django
File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in class AbstractBaseUser(models.Model): File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/models/base.py", line 117, in new new_class.add_to_class('_meta', Options(meta, app_label)) File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class value.contribute_to_class(cls, name) File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/init.py", line 28, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/utils.py", line 201, in getitem backend = load_backend(db['ENGINE']) File "/home/suainul/dev/Env/lib/python3.7/site-packages/django/db/utils.py", line 125, in load_backend ) from e_user django.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend. Try using 'django.db.backends.XXX', where XXX is one of: 'oracle', 'postgresql', 'sqlite3' -
Views for forms.py for different checkboxes in the same model
I am creating a website where a user can create a project and answer some questions regarding this project. I want the user to be able to select some possible answers from two different checkboxes forms. models.py class Initialquestion(models.Model): INITIAL_ONE_CHOICES = ( ('Diagnostic', 'Diagnostic'), ('Therapeutic','Therapeutic'), ('Population health','Population health'), ('Care-based','Care-based'), ('Triage','Triage'), ('Self-care','Self-care'), ('Health promotion','Health promotion'), ('Remote Monitoring','Remote Monitoring'), ('Remote Consultation','Remote Consultation'), ('Other','Other'), ) INITIAL_TWO_CHOICES = ( ('Primary Care', 'Primary Care'), ('Secondary Care','Secondary Care'), ('Tertiary Care','Tertiary Careh'), ('Individual Care of Self','Individual Care of Self'), ('Triage','Triage'), ('For the purposes of population screening','For the purposes of population screening'), ('Other','Other'), ) initial_one = MultiSelectField(choices=INITIAL_ONE_CHOICES) initial_two = MultiSelectField(choices=INITIAL_TWO_CHOICES) developer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) project = models.OneToOneField(Project, on_delete=models.CASCADE) forms.py from django import forms class InitialquestionForm(forms.ModelForm): INITIAL_ONE_CHOICES = ( ('Diagnostic', 'Diagnostic'), ('Therapeutic','Therapeutic'), ('Population health','Population health'), ('Care-based','Care-based'), ('Triage','Triage'), ('Self-care','Self-care'), ('Health promotion','Health promotion'), ('Remote Monitoring','Remote Monitoring'), ('Remote Consultation','Remote Consultation'), ('Other','Other'), ) INITIAL_TWO_CHOICES = ( ('Primary Care', 'Primary Care'), ('Secondary Care','Secondary Care'), ('Tertiary Care','Tertiary Careh'), ('Individual Care of Self','Individual Care of Self'), ('Triage','Triage'), ('For the purposes of population screening','For the purposes of population screening'), ('Other','Other'), ) initial_one = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=INITIAL_ONE_CHOICES) initial_two = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=INITIAL_TWO_CHOICES) developer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) project = models.OneToOneField(Project, on_delete=models.CASCADE) class Meta: model = Initialquestion I am struggling to create … -
S3 versioning with django-storages
I use django-storages in my app, and I want to use S3 versioning just out of the box. I mean, I want to store and retrieve different versions of the same file without implementing any additional mechanism. By reading the docs, I understand that: Retrieving an object is as easy as adding a version=XX parameter to the GET request. Uploading an object is handled by S3 itself. You just need to configure versioning in your bucket But, going to the code. If I have this: from django.db import models from django_s3_storage.storage import S3Storage storage = S3Storage(aws_s3_bucket_name='test_bucket') class Document(models.Model): name = models.CharField(max_length=255) s3_file = models.FileField(storage=storage) How can I get one specific version of a Document? Something like: doc = Document.objects.get(pk=XX) doc.s3_file.read(version=XXXXXXXXXX) # Something like this? I've been reading the official documentation, but can't find how to: Get available versions of an object Retrieve one specific version Any help is appreciated. -
Getting Forbidden (CSRF token missing or incorrect.): /myurl/ error while Overriding ObtainJSONWebToken
I inherit ObtainJSONWebToken and trying to override its post method but every time I hit API It throws me error : Forbidden (CSRF token missing or incorrect.): /myurl/ class LoginDrfJwtView(ObtainJSONWebToken): def post(self, request, *args, **kwargs): response = super(LoginDrfJwtView, self).post(request, *args, **kwargs) if condition == True: # my code return True -
I can't create tables after migrating the models from Django models.py
so i created a user from django.contrib.auth.models import User and i managed to migrate it to MySQL database using python manage.py makemigrations python manage.py migrate but when i tried to add new tables in my app model.py when i makemigrations is sais that "No changes detected" and when i use python manage.py migrate i reciev this message which includes the user tables but none of the models i created Operations to perform: Apply all migrations: admin, api, auth, authtoken, contenttypes, sessions Running migrations: No migrations to apply. my model code from django.db import models from django.contrib.auth.models import User CHOICES = ( (None, "indéterminé"), (True, "actif"), (False, "non actif") ) class Departement(models.Model): id = models.AutoField(primary_key=True) nom = models.TextField(max_length=255) fk_transfo = models.ForeignKey(Transfo, on_delete=models.CASCADE) def __str__(self): return self.nom class PointMesure (models.Model) : id = models.AutoField(primary_key=True) nom = models.TextField(max_length=64) etat = models.NullBooleanField(choices = CHOICES) nbHeursCons = models.FloatField() fk_departement = models.ForeignKey(Departement, on_delete=models.CASCADE) def __str__(self): return self.nom class Mesure (models.Model): id = models.AutoField(primary_key=True) t = models.FloatField() i1inst = models.FloatField() i2inst = models.FloatField() i3inst = models.FloatField() i4inst = models.FloatField() u1inst = models.FloatField() u2inst = models.FloatField() u3inst = models.FloatField() p1 = models.FloatField() p2 = models.FloatField() p3 = models.FloatField() fk_PointMesure = models.ForeignKey(PointMesure, on_delete=models.CASCADE) def __int__(self): return self.id class ValCle … -
how to deal with dynamic items that are used on the base.html in Django
I have some dynamic fields on the base.html like the footer text and the social accounts links, but I need to fetch them from the database and send them alongside with each response for a view that uses a template which extends the base.html template. right now I am fetching the needed Items on every view and send them alongside with the view context, but I feel that this is repetitive, especially if I have more dynamic items, I tried also to save them to the request session but also it will require more code and edge cases. what is the most efficient way to fetch these items once and be able to use them on all the views that extends the base.html template? -
How to load data from a model into django settings.py variable?
I am writing a django application where I have a model called Website which contains websites of people. I only allow people who have their websites in my database to use my Django REST API. I am using the django-cors-headers package to whitelist the domains of people: https://github.com/adamchainz/django-cors-headers. CORS_ORIGIN_WHITELIST variable in settings.py allows me to white list domains as shown in https://github.com/adamchainz/django-cors-headers#cors_origin_whitelist The problem is that I have to query my models to get the website domains, append them to a list and then put that list into CORS_ORIGIN_WHITELIST. But I can't do that in settings.py because models are loaded after the app starts and settings.py is the one that starts the app. Does anyone know a way around that? Any suggestions will be appreciated. Thanks in advance. -
Converting latitude and longitude columns into a geopoint in django
I have latitude and longitude as separate columns and want to use geo point in Elasticsearch. How can i convert the columns into geopoint so I can find all points in database within a given radius. -
Trouble with deploy django channels using Daphne and Nginx
I got a 502 error when I'm trying to open a website. I used the instructions from the official website link Added new file lifeline.conf at /etc/supervisor/conf.d/ lifeline.conf [fcgi-program:asgi] # TCP socket used by Nginx backend upstream socket=tcp://localhost:8000 # Directory where your site's project files are located directory=/home/ubuntu/lifeline/lifeline-backend # Each process needs to have a separate socket file, so we use process_num # Make sure to update "mysite.asgi" to match your project name command=/home/ubuntu/Env/lifeline/bin/daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-head$ # Number of processes to startup, roughly the number of CPUs you have numprocs=4 # Give each process a unique name so they can be told apart process_name=asgi%(process_num)d # Automatically start and recover processes autostart=true autorestart=true # Choose where you want your log to go stdout_logfile=/home/ubuntu/asgi.log redirect_stderr=true Setup nginx conf upstream channels-backend { server localhost:8000; } server { listen 80; server_name staging.mysite.com www.staging.mysite.com; client_max_body_size 30M; location = /favicon.ico { access_log off; log_not_found off; } location / { try_files $uri @proxy_to_app; } location @proxy_to_app { proxy_pass http://channels-backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; } } I checked the asgi log file and it contains … -
Check if no url parameters been provided
i need to check an incoming url in my view, if any parameter has been provided. Already checked various approcaches with the request.GET option but did not find the suitable way. Most of them test for a defined parameter to be set or none like if self.request.GET.get('param'): But what i need is the result, when the url is missing any parameter like http://myapp/app/ instead of http://myapp/app/?param=any to set the queryset to a default. Any ideas o this? Moe -
Using VueJS with Django
I'm looking forward to adding Vue.JS to my Django project. I'm having some troubles on where to start. From the little i know, Vue is a Javascript Framework, so i need to add the CDN to my template, but is that it? I made some research online and found this tutorial. What is the difference between just adding a CDN to my Django templates and following that tutorial? -
django handle slowly when doing Stress Testing
i had built django server to handle some work.And when i sent 10000 requests to django,django will became slow after 4000th requests,it will report socket timeout randomly.And i take this one data to test it alone,it is ok.So,how can i fix this bug? i have no idea to fix it def handle(request) : sys.stderr.write( "[info]request come in {} \n".format(sys._getframe().f_code.co_name)) ret_dict = dict() ret_str = "" if ("vid" in request.GET) and ("title" in request.GET): id = request.GET["id"] title = urllib.parse.unquote(request.GET["title"],encoding ='utf-8') title = request.GET["title"] req_video = dict() req_video["vid"] = vid req_video["title"] = title tags = handle_function(req_video) ret_dict["vid"] = vid ret_dict["tags"] = tags ret_str = json.dumps(ret_dict) return HttpResponse(ret_str) django can handle these requests quickly -
How to save the number of users registered in mongodb using django?
I have a problem but don't know. I want to save the record of numbers of users registered in mongodb. Just like in django admin page that how many users registered, all the data saved there. I want it to save it in mongodb database instead of letting them in admin page because my other data has all been saved in mongodb. How to do this? Whether to make separate a class in models.py or something else. What to do? -
Django Google Map Widget using Bootstrap
I'm trying to use this Google Map Widget module, more specifically the Point Field widget shown here but it doesn't render properly on my form As you can see from the image, the map overlaps other elements in the form. I was wondering if anyone knows how to prevent this. I am also using bootsrap4 to render the forms. Some Code snippets Form.py class ActivityModelForm(forms.ModelForm): class Meta: model = Activity fields = [ ..... "end_time", "fixed_date", "coordinates", ] widgets = { 'start_time': TimePickerInput(), 'end_time': TimePickerInput(), 'fixed_date': DatePickerInput(), 'description': Textarea(), 'short_description': Textarea(), 'coordinates': GooglePointFieldWidget() } Template.html {% extends 'base_sellers.html' %} {% load static %} {% load bootstrap4 %} {% block content %} <div class="seller-container"> {% include "sellers/suppliers_header.html" %} <div class="content-seller"> {% include "sellers/suppliers_nav.html" %} <main class="content-seller__seller-view u-padding-big"> <section class="seller-activities-box"> <h1>{{ form_title }}</h1><hr><br><br> <div class="activity-form"> <form method="POST" action="" class="form" id="add-activity-form"> {% csrf_token %} {% bootstrap_form form %} <input type="submit" name="" class="btn btn--green" value="{{ submit_btn }}"> </form> </div> </section> </main> </div> </div> {% endblock content %} {% block extrahead %} {% bootstrap_css %} {% bootstrap_javascript jquery=True %} {{ form.media }} {% endblock %} -
I want to override title as safe or strip tag in wagtail admin side explore
I am new to django wagtail, I want to override wagtail admin(CMS view) page explore title there showing tags,I want to remove them. I tried to override template, but there no template <p>Tiny but mighty, chia packs a nutritional punch</p> Tiny but mighty, chia packs a nutritional punch -
Search Suggestions for django elasticsearch
I am using the Django Elasticsearch DSL library in order to integrate django with elasticsearch. I have the search working properly and I am trying to also add the suggestions feature. my documents.py is the following # Name of the Elasticsearch index INDEX = Index('search_movies') # See Elasticsearch Indices API reference for available settings INDEX.settings( number_of_shards=1, number_of_replicas=1 ) html_strip = analyzer( 'html_strip', tokenizer="standard", filter=["standard", "lowercase", "stop", "snowball"], char_filter=["html_strip"] ) @INDEX.doc_type class MovieDocument(DocType): """Movie Elasticsearch document.""" id = fields.IntegerField(attr='id') title = fields.StringField( analyzer=html_strip, fields={ 'raw': fields.KeywordField(), 'suggest': fields.CompletionField(), } ) summary = fields.StringField( analyzer=html_strip, fields={ 'raw': fields.KeywordField(), } )` I have added the 'suggest': fields.CompletionField(), as I saw it is required in order to get suggestions for that field. I am trying then to use something similar as to what is shown here. So in my views.py i have the following client = Elasticsearch() search_in_title = 'search term goes here' s = Search(using=client) sreq = Search().using(client).query("multi_match", query=search_in_title, fields=['title', 'summary']) ssug = s.suggest('title_suggestions', search_in_title, term={'field': 'title'}) but the ssug is always empty, so i am guessing i am using it the wrong way. -
How can I add a button inside DetailView template that sends ID to a form?
I have a App called "Properties" and I've created a DetailView that is working. Inside my Properties models I have a Property model and a Bedroom model with a ForeignKey to Property. #views.py class PropertyDetailView(DetailView): template_name = 'properties/property-detail.html' model = Property def get_context_data(self, **kwargs): contacts = ContactsOwner.objects.filter(owner__property=self.object) context = super().get_context_data(**kwargs) context['contact'] = contacts return context My models.py: class Property(models.Model): property_reference = models.CharField(db_column='Property_Reference', max_length=10) # Field name made lowercase. address = models.CharField(db_column='Address', max_length=250, blank=True, null=True) # Field name made lowercase. post_code = models.CharField(db_column='Post_Code', max_length=15, blank=True, null=True) # Field name made lowercase. type = models.CharField(db_column='Type', max_length=25, blank=True, null=True, choices=HOUSE_TYPE_CHOICES) # Field name made lowercase. bedrooms = models.IntegerField(db_column='Bedrooms', blank=True, null=True) # Field name made lowercase. bathrooms = models.IntegerField(db_column='Bathrooms', blank=True, null=True) # Field name made lowercase. usual_cleaning_requirements = models.CharField(db_column='Usual_Cleaning_Requirements', max_length=250, blank=True, null=True) # Field name made lowercase. notes = models.CharField(db_column='Notes', max_length=500, blank=True, null=True) # Field name made lowercase. feature_image = models.ImageField(null=True) class Meta: db_table = 'Property' def __str__(self): return self.property_reference def get_absolute_url(self): return reverse("properties:property_detail",kwargs={'pk':self.pk}) class Bedroom(models.Model): type = models.CharField(db_column='Type', choices=BEDROOM_TYPE_CHOICES, max_length=50) bed_dimensions = models.CharField(db_column='Bed_Dimension', choices=BED_DIMENSION_CHOICES, max_length=30) image = models.ImageField(null=True, blank=True) ensuite = models.BooleanField(default=False) notes = models.CharField(db_column='Notes', max_length=500, blank=True, null=True) # Field name made lowercase. property = models.ForeignKey(Property, null=False, on_delete=models.CASCADE, related_name='bedroom') What I need is … -
Django sort filtered objects by other model's value
i have following models and i filtered all Songs by Item's object_id field. But then i need to use Item's position to sort them. Is there any way to filter Songs and filter it by `Items' position? class Chart(models.Model): title = models.CharField(max_length=120) content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, limit_choices_to=CONTENT_TYPE_LIMIT) class Version(models.Model): chart = models.ForeignKey("Chart", related_name="versions", on_delete=models.CASCADE) class Item(models.Model): edition = models.ForeignKey(Version, on_delete=models.CASCADE, related_name="items") object_id = models.UUIDField(db_index=True) position = models.PositiveIntegerField() Now i get the chart first by list_ids = chart.versions.last().items.all() and to get Songs i run Songs.objects.filter(id__in=list_ids) But i need to do order_by('position') for this too. Maybe my approach of getting all Songs was wrong. Because Items's object_id must be a Songs id though it is intentionaly not a ForeignKey though. -
In Django REST Framework, how to access kwargs context in html template? {{ view.kwargs.foo }} doesn't work for me
Referring this answer I couldn't access the kwargs in the html template by {{ view.kwargs.foo }}. Not sure why, is it because something's different with DRF so I need a different syntax to access it? My html template ('polls/character_description_list.html'): {% block content %} <table> {% for description in descriptions %} <tr> <td><b>{{ description.title }}</b></td> <td>{{ description.content }}</td> </tr> {% endfor %} </table> <form action="{% url 'polls:description_detail_create_from_character' %}"> <input type="hidden" value="{{ view.kwargs.character_id }}" name="character_id"> <!-- This is where I attempt to access the kwargs but can't get it, although I can attempt to output it anywhere else for debugging --> <input type="submit" value="New Description"/> </form> {% endblock %} Therefore when submitting I expect to go to: http://localhost:8000/myapp/description_detail_create_from_character/?character_id=1 But in reality the id is missing: http://localhost:8000/myapp/description_detail_create_from_character/?character_id= To check if the character_id token I am looking for is in kwargs, I did try to breakpoint (using PyCharm) in get_serializer_context: def get_serializer_context(self): context = super(CharacterDescriptionListView, self).get_serializer_context() return context Examined the context, I can find 'view' -> kwargs -> 'character_id', with the value I am expecting, so it should work. This is my views.py: class CharacterDescriptionListView(DescriptionViewMixin, CustomNovelListCreateView): template_name = 'polls/character_description_list.html' def get_filter_object(self): return get_object_or_404(Character, id=self.kwargs['character_id']) def get_queryset(self): characterObj = self.get_filter_object() return Description.objects.filter(character=characterObj)