Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I cant supply my database with my API using dota2 API
When i run insert_heroes.py file I get this image https://prnt.sc/qlk2bp insert_heroes.py import requests import json if __name__ == '__main__': r = requests.get("https://api.opendota.com/api/heroes") all_heroes_info = json.loads(r.content.decode('UTF-8')) for hero_info in all_heroes_info: name = hero_info['localized_name'] hero_type = hero_info['primary_attr'] mutation_create_hero = ''' mutation ($name: String!, $heroType: String!) { createHero(name: $name, heroType: $heroType) { name } } ''' fill_db = mutation_create_hero, variable_values = {'name': name, 'heroType': hero_type} print(fill_db) I created variable called fill_db to be equal to mutation that will create all new heroes from dota 2 API and then i just printed fill_db. I got all heroes from that get request but problem is that i dont know now how to push all that into my postgreSQL database. I dont have a clue how to do it. I need some kind of command that will put this params and mutation in square brackets as parameters somethig like client.execute() Can you help me guys? -
How do I add or modify attributes on objects before passing them to a template?
I'm not quite sure how to go about this problem. I want to create a view where a user enters a date range and the list of ledgers updates to display balance for that date range. The ledgers are in categories and the categories should also show their balance. This is how far I've got. Models.py class Category(models.Model): name = models.CharField(max_length=255) class Ledger name = models.CharField(max_length=255) sub_category = models.ForeignKey(Category, on_delete=models.PROTECT) def calculate_balance(self, date_from, date_to): """Gives balance based on date range""" money_out = LineItem.objects.filter(ledger=self.id, journal_entry__date__range=[date_from, date_to]).aggregate(Sum('money_out')) money_in = LineItem.objects.filter(ledger=self.id, journal_entry__date__range=[date_from, date_to]).aggregate(Sum('money_in')) if money_out['money_out__sum'] == None: money_out['money_out__sum'] = 0 if money_in['money_in__sum'] == None: money_in['money_in__sum'] = 0 balance = round(money_in['money_in__sum'] - money_out['money_out__sum'],2) return balance class LineItem(models.Model): date = models.DateField(null=False, blank=False) ledger = models.ForeignKey(Ledger, on_delete=models.PROTECT) description = models.CharField(max_length=255, null=True, blank=True) money_out = models.DecimalField(max_digits=8, decimal_places=2, null=True, blank=True) money_in = models.DecimalField(max_digits=8, decimal_places=2, null=True, blank=True) Template.html <ul> {% for category in categories %} <li>{{category.name}} - {{category.balance}}</li> <ul> {% for ledger in category.ledger_set.all %} <li>{{ ledger.name }} - {{ ledger.balance }}</li> {% endfor %} </ul> {%endfor%} </ul> views.py Does not work. I've calculated the ledger balance correctly according to date range but can't pass the balance to the view. And haven't figured out how to calculate the category … -
Django Show and Save file
I'm making a docx file by taking inputs from user. The docx file is being created in the root directory of the project. The form which takes input from user is not a model form as I want to confirm from user saving the file if he/she wants to save file. How can I show docx file on the next page with a model form to save the file? -
Create from from multiple user selected records in Djano
I just want to make sure I am approaching this problem the right way. I have a Model of interview questions that have associated tags and categories. I also have a model of interview responses that are related to the questions. I want my users to be able to select some number of categories and tags, and then be presented with a form to fill out responses to all associated questions. I have a junk solution that kind of works but it feels like there should be a simpler way. Currently I have one view for users to select the categories and tags. I set that is a global variable in views.py and pass that to my second view that is supposed to present the questions and a response text box. I am having to do this with multiple forms on the same page which makes submission a bit wonky. The weirdness is that each form has its own submit button and once submitted all the response fields get updated to the same text I assume because Django renders all of those text boxes with the same name attribute. So I guess the overall question is: Is there a standard … -
How do I create user's password on the member add page?
I'm using django-groups-manager. After logging in, I can add users from the add user page. However, I cannot create the password. I want to set the password when adding a user. How can I do it? forms.py class CalisanForm(forms.ModelForm): member = forms.CharField(max_length=100, label='Çalışan Adı') class Meta: model = User fields = [ 'member', ] views.py def calisan(request): form = CalisanForm(request.POST or None) if form.is_valid(): member = form.cleaned_data['member'] member = Member.objects.create(first_name=member) return redirect('home') return render(request, 'accounts/calisan/calisan.html', {'form': form}) -
Django TabularInline - Totaling rows dynamically as user types in hours
I am building a time keeping application in Django 3.0 using Python 3.7.4. Here is an example of what my tabular inline looks like in Django. https://imgur.com/YmEE6KM Is there a way in Django to dynamically total up the rows as the users type in the hours? For example, in the image above, I would ideally like the Estimated Time to equate to 8 hours, Actual Time to equate to 8 hours, and the Unplanned Time to equate to 0. I'm trying to avoid the user from saving the model to see the total amount of hours they have entered. -
Using reverse ForeignKey relation to get count of children for current object not working properly
I'm currently making a Todo app, I have multiple Todolist that can each contain multiple tasks, here's how I made my models : class Todo(models.Model): name = models.CharField(max_length=120) total_tasks = models.IntegerField(default=0) completed_tasks = models.IntegerField(default=0) def update_total_tasks(self): self.total_tasks = self.task_set.all() def _str_(self): return self.name class Task(models.Model): name = models.CharField(max_length=120) completed = models.BooleanField(default=False) todo = models.ForeignKey(Todo, on_delete=models.CASCADE, related_name="tasks") My todo contains all current tasks as well as completed tasks, the update_total_tasks function is meant to query all tasks linked to that particular todo and update the field accordingly. This function is called each time a task is created / updated with : @receiver(models.signals.post_save, sender=Task) def execute_after_save(sender, instance, created, *args, **kwargs): instance.todo.update_total_tasks() The receiver works and calls my update function properly though it seems the query is done the wrong way because I get this error : AttributeError: 'Todo' object has no attribute 'task_set' Do you have any idea on why it's not working properly ? Thanks. -
Django model constraint - Sum of all rows for a user less than a constant
I need to add a constraint to a Django model to check for the sum of all previous values in the model for a specific user. Class Book(models.Model): user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) name = models.CharField(max_length=50) price = models.Decimal(max_digits=6, decimal_places=2) class Meta: models.CheckConstraint(check=models.Q(price__lte=1000), name='weight_lte_1000') This constraint applies to each entry, but I need another check to make sure the sum of all values of price for books linked to a specific user stays below 1000. -
Socio Economic Modelling
Is there anyone here who would be interested in working with me on a socio-economic model of disease? The aim is to use Microsoft Visual Studio 2017 enterprise, Django, Python and MS-SQL Server. Best wishes, Neil -
django not connecting to web server
Am trying to use django, a python framework but it doesnt connect to the web server with the ip address it provides after I run the code 'python manage.py runserver' it should open up with some congratulations! page but it keeps telling me can't reach the site -
Calling a detail view inside another view if condition is true
I want to call a detail view inside a view if the condition is true, but I always have the same error "context must be a dict rather than str." My code is: class VotacionView(LoginRequiredMixin, FormMixin, DetailView, request): model = Votacion form_class = realizarVotacionForm template_name = "RealizarVotacion.html" success_url = reverse_lazy('home') def __init__(self, **kwargs): super().__init__(**kwargs) def get_success_url(self): return reverse('home') def get_context_data(self, **kwargs): if not self.object.voto_rectificable: if UsuarioVotacion.objects.filter(user=self.request.user, Votacion=self.object).exists(): return reverse('estadisticasvotacionsimple', kwargs={'pk': self.object.pk}) more stuff... -
Django Envrionment Variables
am trying to make a blog app using django, and i want to use environment variables to hide sensitive information. I tried putting my data in .bash_profile and access it as described in the photos attached, however, it does not seem to be working. My photos and information only loads if I hardcode the data. I don’t know how to fix this problem, please help. How I am refering to the data in .bash_profile: AWS_ACCESS_KEY_ID = os.environ.get(‘AWS_ACCESS_KEY_ID’) Doesn't work if i write the above instead of hard coding it fyi, I am using ubuntu 18 and vs code to code.bash_profile Only works if i hard code it -
Simple carpooling tracker python/django webapp
I recently started learning python and django. as my first project i wanted to make a simple webapp that tracks who's turn it is to carpool and save this is a sqlite db, with buttons on a webpage to where if you select the people that are carpooling that day, the app will automaticly determine who's turn it is today. Can you guys help me get started with this cause i don't know how to start. Kind regards! -
what is the right way to create webpage and python interaction?
I want to create a webpage (index.html) that takes an image (a.jpg), processes it with python neuralnetwork script (nn.py) and displays result (text) on this webpage (index.html). My recent unsuccessful tries: - django (inside views): just really bad (not suited for heavy tasks) - django + background-tasks: clunky, not suited for long-polling, the answer should be displayed as soon as ready - node.js/ajax: im unexperienced in nodejs, so it is hard to think of a correct solution (maybe nodejs/ajax + python socket listener) What is the best way to implement it? index.html <body> <form action="URL"> <input type="image" src="img_source" alt="Submit"> <p>put text here when ready</p> </form> </body> nn.py def nn(image): .... return text -
Custom Django Model Managers giving error when trying to use it
I'm trying to write a simple model manager that will filter on a particular field. I have a model which looks like this: """Model definition for Period.""" year = models.ForeignKey(Year, on_delete=models.PROTECT) name = models.CharField(max_length=50) active = models.BooleanField(default=False) objects = models.Manager() active_year_periods = PeriodManager().active_year_periods() My Period manager looks like this: class PeriodManager(models.Manager): """ The manager for Period objects """ def active_year_periods(self): """ Gets the Period objects for the active year Returns: Period<Queryset> -- Periods for an active year """ return super().get_queryset().filter(year__active=True) I wrote something simple to test this particular manager, but am running up against an error which I'm not sure what it means: File "/dir/path/myapp/models.py", line 44, in <module> class Period(models.Model): File "/dir/path/myapp/models.py", line 55, in Period active_year_periods = PeriodManager().active_year_periods() File "/dir/path/myapp/managers.py", line 19, in active_year_periods return self.get_queryset().filter(year__active=True) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/query.py", line 892, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/query.py", line 910, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1290, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1318, in _add_q split_subq=split_subq, simple_col=simple_col, File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1190, in build_filter lookups, parts, reffed_expression = self.solve_lookup_type(arg) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1049, in solve_lookup_type _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) File "/dir/path/venv/lib/python3.7/site-packages/django/db/models/sql/query.py", line 297, in get_meta return self.model._meta AttributeError: 'NoneType' object … -
Django admin/ Chart js error - super() takes at least 1 argument (0 given)
I am overriding django admin (using changelist_view) to display a bar chart (using chart.js) above the data in an admin view. Using this example as a reference: https://findwork.dev/blog/adding-charts-to-django-admin/ . Getting Error: TypeError at /admin/machines/machinescurrentdaythreadbreaks/ super() takes at least 1 argument (0 given) Request Method: GET Request URL: http://localhost/admin/machines/machinescurrentdaythreadbreaks/ Django Version: 1.9 Exception Type: TypeError Exception Value: super() takes at least 1 argument (0 given) Exception Location: /home/epicar/EPIC-Django/EPIC_AR/machines/admin.py in changelist_view, line 557 Python Executable: /usr/bin/python Python Version: 2.7.9 Python Path: ['/home/epicar/EPIC-Django/EPIC_AR', '/home/epicar/EPIC-Django/venv/lib/python2.7/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2'] Server time: Thu, 9 Jan 2020 17:50:04 +0000 admin.py looks like this for model: def changelist_view(self, request, extra_context=None): # Aggregate breaks per head, per needle chart_data = ( MachinesCurrentDayThreadBreaks.objects.annotate(breaks=Count("sum")) .values("sum") .annotate(y=Count("sum")) .order_by("head_position") ) # Serialize and attach the chart data to the template context as_json = json.dumps(list(chart_data), cls=DjangoJSONEncoder) extra_context = extra_context or {"chart_data": as_json} # Call the superclass changelist_view to render the page return super().changelist_view(request, extra_context=extra_context) -
"Import Error" : on importing admin files from one project folder to another under same directory
DIR path: Directory Tree.jpg tests/admin.py: from django.forms import ModelForm from openwisp_utils.admin import AlwaysHasChangedMixin, ReadOnlyAdmin from .models import Operator, Project, RadiusAccounting @admin.register(Operator) class OperatorAdmin(admin.ModelAdmin): list_display = ['first_name', 'last_name'] @admin.register(RadiusAccounting) class RadiusAccountingAdmin(ReadOnlyAdmin): list_display = ['session_id', 'username'] fields = ['session_id', 'username'] class OperatorForm(AlwaysHasChangedMixin, ModelForm): pass class OperatorInline(admin.StackedInline): model = Operator form = OperatorForm extra = 0 @admin.register(Project) class ProjectAdmin(admin.ModelAdmin): inlines = [OperatorInline] list_display = ['name'] openwisp_utils/admin.py: from django.contrib.admin import ModelAdmin class TimeReadonlyAdminMixin(object): """ mixin that automatically flags `created` and `modified` as readonly """ def __init__(self, *args, **kwargs): self.readonly_fields += ('created', 'modified',) super(TimeReadonlyAdminMixin, self).__init__(*args, **kwargs) class ReadOnlyAdmin(ModelAdmin): """ Disables all editing capabilities """ def __init__(self, *args, **kwargs): super(ReadOnlyAdmin, self).__init__(*args, **kwargs) self.readonly_fields = [f.name for f in self.model._meta.fields] def get_actions(self, request): actions = super(ReadOnlyAdmin, self).get_actions(request) if 'delete_selected' in actions: # pragma: no cover del actions['delete_selected'] return actions def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): return False def save_model(self, request, obj, form, change): # pragma: nocover pass def delete_model(self, request, obj): # pragma: nocover pass def save_related(self, request, form, formsets, change): # pragma: nocover pass def change_view(self, request, object_id, extra_context=None): extra_context = extra_context or {} extra_context['show_save_and_continue'] = False extra_context['show_save'] = False return super(ReadOnlyAdmin, self).change_view(request, object_id, extra_context=extra_context) class AlwaysHasChangedMixin(object): def has_changed(self): """ This django-admin trick … -
Setting up a registration function in views.py (error message when I try to run the server)
I am having this error message come up when I try to run the server: django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form UserProfileInfoForm needs updating. Can anyone tell me what it means so I can correct my code, please? Here is a screenshot: Screenshot of views.py -
Django Admin for Multiple Django applications
I have been developing a Django project with multiple applications using multiple databases. What I need is a different admin site for each app. For example, myapp should use an admin site that just belong to itself. In other words, I need something like http://127.0.0.1:8000/myapp_admin/ on the browser to access its relevant database on the admin site. This is what I've done so far: class MultiDBModelAdmin(admin.ModelAdmin): # A handy constant for the name of the alternate database. using = 'db_myapp' def save_model(self, request, obj, form, change): # Tell Django to save objects to the 'other' database. obj.save(using=self.using) def delete_model(self, request, obj): # Tell Django to delete objects from the 'other' database obj.delete(using=self.using) def get_queryset(self, request): # Tell Django to look for objects on the 'other' database. return super().get_queryset(request).using(self.using) def formfield_for_foreignkey(self, db_field, request, **kwargs): # Tell Django to populate ForeignKey widgets using a query # on the 'other' database. return super().formfield_for_foreignkey(db_field, request, using=self.using, **kwargs) def formfield_for_manytomany(self, db_field, request, **kwargs): # Tell Django to populate ManyToMany widgets using a query # on the 'other' database. return super().formfield_for_manytomany(db_field, request, using=self.using, **kwargs) In the admin.py file, I have this: mammothholdingsadminsite = admin.AdminSite('mammothholdingsadminsite') mammothholdingsadminsite.register(User, MultiDBModelAdmin) In the urls.py file, I have this: from django.urls import … -
Executing manage.py in Django Management Shell
I am attempting to execute manage.py using Django Management Shell in Visual Studio 2017 Enterprise. Django Management Shell The purpose of this was to run a Django Migration to a particular database. I have installed database routers to point individual models to individual databases according to read/write. Best wishes, Neil -
Is there any way to append table column in django?
table name is 'TestTable'. and How can add a new coloumn in table which is #hold in markAtrr veriable. def createTest(request): markAttr=request.POST.get('Attr') obj=TestTable() -
Django combine 2 QuerySets
I have 2 QuerySets that target different tables in the same database. What i'm trying to achieve is to filter results by created_at and then by hit_count. I'm using django-hitcount for the hit_count Here's the Model class Post(models.Model): STATUS_CHOICES = ( (1, 'Technology'), (2, 'Security'), (3, 'Android|iOS'), ) id = models.UUIDField(primary_key=True, default=uuid.uuid4, unique=True, editable=False) title = models.CharField(max_length=250) body = models.TextField() main_image = models.ImageField(null=False, upload_to=save_image) second_image = models.ImageField(blank=True, default="") third_image = models.ImageField(blank=True, default="") fourth_image = models.ImageField(blank=True, default="") fifth_image = models.ImageField(blank=True, default="") slug = models.SlugField(blank=True, default="", editable=True) created_at = models.DateField(default=date.today) category = models.PositiveSmallIntegerField(choices=STATUS_CHOICES, default=1) custom = managers.PostManager() Here's the Manager class PostManager(models.Manager): def get_queryset(self): return super(PostManager, self).get_queryset() def get_tech(self): return self.get_queryset().filter(category=1) def get_security(self): return self.get_queryset().filter(category=2) def get_mobile(self): return self.get_queryset().filter(category=3) def get_category_count(self): return self.get_tech().count(), self.get_security().count(), self.get_mobile().count() def get_top_stories_of_month(self): s_date = datetime.strftime(datetime.now() - timedelta(days=25), '%Y-%m-%d') e_date = datetime.strftime(datetime.now() - timedelta(days=32), '%Y-%m-%d') qs1 = self.get_queryset().filter(Q(created_at__lte=s_date) | Q(created_at__gte=e_date)) qs2 = HitCount.objects.order_by('hits') As you see, i have stored the results to qs1 and qs2, but have no idea how to combine them. I also have played around in the shell to try to filter out the objects in the query_set by object_pk's which they have in common. The result is very strange tho, when comparing pk's it … -
Django If Statement Date Created
Im doing a point system and the points have to be entered in a certain time frame for it to be valid for a student to earn recess. Here is the following logic i have so far. What the logic needs to be : The following points need to be equal to 20 or greater , time frames 1,2,3 need to be logged before 10:00am and filtered by todays date. How would i write this ? Thank you! views.py if grand_total >= 20 and K8Points.objects.filter(time_frame= 1).exists()and K8Points.objects.filter(time_frame= 2).exists()and K8Points.objects.filter(time_frame= 3).exists().filter (date=date): morning_recess = "YES" models.py class K8Points(models.Model): date = models.DateField(default=datetime.date.today()) class_name = models.ForeignKey(TeacherClass, on_delete = models.PROTECT, default = "",) student_name = models.ForeignKey(Student,on_delete = models.CASCADE, default ="" ,) week_of = models.IntegerField(default=weeknumber) day = models.CharField(max_length= 10, default = dayofweek) TIME_FRAME_CHOICES = [ (None, 'PLEASE SELECT TIME FRAME'), # THIS IS OPTIONAL (1, '(1.) 8:45AM - 9:00AM'), (2, '(2.) 9:00AM - 9:30AM'), (3, '(3.) 9:30AM - 10:00AM'), (4, '(4.) REC. I 10:00AM -10:10AM'), (5, '(5.) 10:10AM-10:40AM'), (6, '(6.) 10:40AM-11:10AM'), (7, '(7.) 11:10AM-11:40AM'), (8, '(8.) REC II LUNCH 11:40AM-12:20PM'), (9, '(9.) 12:20PM-12:50PM'), (10,'(10.) 12:50PM-1:20PM'), (11,'(11.) 1:20PM-1:50PM'), (12,'(12.) 1:50PM-2:20PM'), (13,'(13.) REC. III 2:20PM-2:30PM'), ] time_frame = models.PositiveSmallIntegerField(choices=TIME_FRAME_CHOICES,) behavior = models.IntegerField(default="", validators=[ MaxValueValidator(5), MinValueValidator(1) ]) academic … -
How to compare a key stored in models.py with the key fetched from the POST request?
I want to check the validity of the consumer_key. I have stored one in the models.py as a CharField but how do I go on and fetch it for comparison ? This might help understand the problem better . Models.py class Verification(models.Model): consumer_key = models.CharField(max_length=30) hidden_key = models.CharField(max_length=30 , default="") Views.py from .models import Verfication id = Verification.objects.filter() if request_key ==id.values('consumer_key'): consumer = oauth2.Consumer( key=request_key,secret= id.values('hidden_key')) request_key contains the oauth_consumer_key . -
How, and why, can Foreign Key integrity errors occur in Django 3.0x?
I am trying to create a to-do list app in Django, and I want to link a user's profile to his own to-do list, to-do list items, and an additional deadline class. I am currently trying to create my super user using createsuperuser. However, I am receiving an exception in that my Foreign Key Constraint has failed. Below is a traceback: File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute return super().execute(*args, **options) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, **options) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 189, in handle self.UserModel._default_manager.db_manager(database).create_superuser(**user_data) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/contrib/auth/models.py", line 158, in create_superuser return self._create_user(username, email, password, **extra_fields) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/contrib/auth/models.py", line 141, in _create_user user.save(using=self._db) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 66, in save super().save(*args, **kwargs) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/db/models/base.py", line 746, in save force_update=force_update, update_fields=update_fields) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/db/models/base.py", line 795, in save_base update_fields=update_fields, raw=raw, using=using, File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in send for receiver in self._live_receivers(sender) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp> for receiver in self._live_receivers(sender) File "/Users/ganesh/dev/WebApp/WebApp/users/signals.py", line 10, in create_profile Profile.objects.create(user=instance) File "/Users/ganesh/dev/WebApp/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return …