Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I getting an error, 'QueryDict' object has no attribute 'user'
I've made a form to store customer feedback, It's working fine. Now my motive is that, create a update feedback form so that a user can be able to update their feedback. I also have made a feedback form, but it's not working perfectly. It shows an error😢. Please check the UpdateFeedback view. Where did the actual problem occur? Please give me the relevant solution... views.py: It's working fine made for storing the feedback. def feedBack(request,quick_view_id): quick_view = get_object_or_404(Products, pk=quick_view_id) if request.method == "POST" and request.user.is_authenticated: try: ProductREVIEWS.objects.create( user=request.user, product=quick_view, feedBACK=request.POST.get('feedBACK'), ) messages.success(request,"Thanks for your feedback.") return redirect('quick_view', quick_view_id) except: return redirect('quick_view', quick_view_id) else: return redirect('quick_view', quick_view_id) but the problem is here. It's not working perfectly. def UpdateFeedback(request, id): feedback = ProductREVIEWS.objects.get(pk=id) product_id = feedback.product.id reviewers = feedback.user if request.method == "POST": form = UpdateFeedback(request.POST) if form.is_valid() and reviewers.id == request.user.id: UpdateFeedback(request.POST) feedBACK = form.cleaned_data.get('UpdateFeedBACK') feedback.feedBACK = feedBACK feedback.save() messages.success(request, "Comment updated") return redirect('quick_view', product_id) forms.py for UpdateFeedback: class UpdateFeedback(forms.ModelForm): class Meta: model = ProductREVIEWS fields = ('feedBACK') labels = { 'feedBACK':'Change Your View' } widgets = { 'rating':forms.NumberInput(attrs={'class':'form-control', 'style':'font-size:13px;'}), 'feedBACK':forms.Textarea(attrs={'class':'form-control', 'style':'font-size:13px;'}) } models.py: class ProductREVIEWS(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='userREVIEW',on_delete=models.CASCADE) product = models.ForeignKey(Products, related_name='productREVIEWrelatedNAME',on_delete=models.CASCADE) feedBACK = models.TextField(blank=True, null=True) urls.py: path("feedBack/<int:quick_view_id>/", … -
How can I redirect users to different pages based on session data in python
I'm new to django and wanted some guidance on my project. I want to create a web application for managing traffic violations. Where do I have to start?enter image description here Here is an example of analysis generated with windev. -
How to create Workspaces and manage them for all the users in Django?
I have a complete Login and Registration system in my Django app, that lets me register users, log in users, logout users, change passwords, reset passwords, invite users. I have all the basic functionality. I want now to have Workspaces for users, as per following points: There will be a workspace admin of each workspace. Workspace admins can only add/remove (register/delete) users to his own workspaces. Users can react to (log in to) only those workspaces to which they have been added. A superuser (main admin) can manage all workspaces, all workspaces-admins and all users. How do I accomplish this? You can say this is similar to a Slack thing. I just need a guidelines/roadmap and I will implement it myself. I have already created a Workspace Model, which looks like below: class Workspace(models.Model): name = models.CharField(max_length=254) created_at = models.DateTimeField(auto_now_add=True) def make_admin(self, user): user.is_workspace_admin = True user.save() def remove_admin(self, user): user.is_workspace_admin = False user.save() and my User model has following two attributes beside other default Django fields: class User(AbstractBaseUser, PermissionsMixin): is_workspace_admin = models.BooleanField(default=True) workspaces = models.ManyToManyField(Workspace) Is this approach correct? If not please guide me to the proper way. BTW, using this approach, I can add/assign workspaces to any user, … -
Show An Alert message Before Submitting the Page Django
I want to create a alert message before submitting the page , my admin py class NameAdmin(MasterDataBaseAdmin): form = forms.NameForm inlines = [AddressInline, RegistrationTypeInline] queryset = models.Name.objects.prefetch_related( "names", "name__id", "registrationstype" ) views.py class NameViewSet(viewsets.ReadOnlyModelViewSet): queryset = models.Country.objects.supported().prefetch_related("names", "registrationstype") serializer_class = serializers.NameSerializer I want to just add this meesage in the Message Box "Are You Sure You Want To Save The Page!" -
How to make Django messages framework play nicely with i18n?
Using django 4.0.6 I was using the messages framework to display messages when users successfully completed a form. Then I added i18n: When the default language is selected, messages are shown on the second screen after the form is submitted, not the first. When the not-default language is active, untranslated messages are shown, on the first screen after the message is created (as expected). I've tried using both gettext_lazy and gettext and it didnt help. Its an unusual bug and Im not sure what I've done wrong? views: from django.utils.translation import gettext_lazy as _ from django.views.generic.edit import CreateView ... class ContactView(SuccessMessageMixin, CreateView): template_name = "contact-form.html" form_class = ContactForm success_url = reverse_lazy("base:home") success_message = _("Thanks for contacting us.") def form_valid(self, form): if contact_form_filter(form): create_and_send_contact_form_email(form) return super().form_valid(form) def form_invalid(self, form): """If the form is invalid, render the invalid form.""" return self.render_to_response(self.get_context_data(form=form)) settings: TIME_ZONE = "CET" LANGUAGE_CODE = "en" USE_I18N = True WAGTAIL_I18N_ENABLED = True USE_L10N = True # Deprecated in Django 4, but still used in Wagtail I believe USE_TZ = True WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [ ("en", _("English")), ("nl", _("Dutch")), ] INSTALLED_APPS = [ ... "django.contrib.messages", ... ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "corsheaders.middleware.CorsMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.cache.UpdateCacheMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.cache.FetchFromCacheMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", … -
How Do I design my Model and Serializer for Api?
I got this image as an UI Here there is the question topic, below there is a question and the user needs to provide the answer. There could be around 5-6 questions and user need to fill all question else validation error or incomplete form error is raised. I have thought of this way. class ModelQuestions(BaseModel): MODEL_CATEGORY_CHOICES = ( ('Circumstances', 'Circumstances'), ('Thoughts', 'Thoughts'), ('Feelings', 'Feelings'), ('Action', 'Action'), ('Result', 'Result')) model_subcategory = models.CharField(max_length=50, choices=MODEL_CATEGORY_CHOICES) questions = models.CharField(max_length=200) def __str__(self): return self.model_subcategory class ModelAnswer(BaseModel): questions = models.ForeignKey( to=ModelQuestions, on_delete=models.CASCADE ) answer = models.TextField() user = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return f'{self.questions} - by {self.user.fullname}' is the database design correct? how do I write my serializer in order to validate that all forms are filled? any hint will be very special. -
Django rest framework - generate TOTP and serialize it?
I am not sure how to do this: I want create an end point where an authenticated user can click to get a TOTP. The function which I have used as a separate file: # gen_totp.py import hmac, base64, struct, hashlib, time def get_hotp_token(secret, intervals_no): key = base64.b32decode(secret, True) msg = struct.pack(">Q", intervals_no) h = hmac.new(key, msg, hashlib.sha1).digest() o = h[19] & 15 h = (struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000 return h def get_totp_token(secret): return get_hotp_token(secret, intervals_no=int(time.time())//30) Then to serialize: from re import U from rest_framework import serializers # totp serializer class totp_serializer(serializers.Serializer): totp = serializers.IntegerField(get_totp_token()) I am stumped on how to provide secret to get_totp_token() in the totp_serializer. -
Is there any way to encrypt the URL that is shown to the user in the browser to prevent link sharing?
I am looking for a way to encrypt the URL that is displayed to the user to prevent link sharing between users. This way I would be forcing the user to go through certain steps to access a certain path. I am using the Django Framework and everything I have seen so far for encrypting the URL is in regards to hiding paths, however the URL is still valid and can be shared. In my case I want to show the user an invalid URL in the browser after the request with the valid URL has already been made. Any suggestions for this? -
Need help in django model
I have written a model for my django project. This is my model from django.utils.translation import ugettext_lazy as _ from django.db import models from django.utils.crypto import get_random_string from django.db import models from django.contrib.auth.models import( BaseUserManager, AbstractBaseUser, PermissionsMixin, ) def generate_vid(): """Generates a vid for the users""" not_unique = True while not_unique: vid = get_random_string(10, 'abcdefg0123456789') if not User.objects.filter(v_id = vid).exists(): not_unique=False return vid class UserManager(BaseUserManager): """Model for user manager""" def create_user(self, username, password, **params): """Create and return a user""" u_type = params.pop('usertype','v') params.update({'usertype':u_type}) p_username = params.pop('parent_username', 0) if(u_type=='v'): pass else: parent_id = User.objects.filter(username = p_username).values_list('v_id') params.update({'parent_id': parent_id}) user = self.model(username=username, **params) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, username, password, **params): """Create and return a user""" params.setdefault('is_staff',True) params.setdefault('is_superuser',True) params.setdefault('is_active',True) if params.get('is_staff') is not True: raise ValueError(_('Superuser must have is_staff=True.')) if params.get('is_superuser') is not True: raise ValueError(_('Superuser must have is_superuser=True.')) return self.create_user(username, password, **params) class User(AbstractBaseUser, PermissionsMixin): """Models for user""" v_id = models.CharField( max_length=10, default=generate_vid, primary_key = True, ) username = models.CharField(max_length=20, unique=True) email = models.EmailField(blank=True, unique = True) parent_id = models.ForeignKey('User', on_delete=models.SET_DEFAULT, default=0) usertype = models.CharField(max_length=1, choices=[('f', 'family'), ('v', 'veteran')]) REQUIRED_FIELDS = ['usertype'] is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) USERNAME_FIELD = 'username' objects = UserManager() def __str__(self): return self.username Now I … -
Error in postgresql from sqlite during django project creation
I got an error when I changed sqlite to postgresql while making an app with django. Shows the error that occurred. conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'django', 'USER': 'myuser', 'PASSWORD': 'mypassword', 'HOST': 'localhost', 'PORT': '5432', } } -
DJANGO REST KNOX EXPIRED
I use django rest knox I would not like my session to expire when using my app 'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512', 'AUTH_TOKEN_CHARACTER_LENGTH': 64, 'TOKEN_TTL': timedelta(hours=0.0166667), 'USER_SERIALIZER': 'knox.serializers.UserSerializer', 'TOKEN_LIMIT_PER_USER': None, 'AUTO_REFRESH': True, # 'EXPIRY_DATETIME_FORMAT': api_settings.DATETME_FORMAT }``` -
how do I run a beta and production version of a django-project alongside each other?
What is the recommended way to run a "beta server" alongside the production server for a django project? I think about setting up a beta.mydomain.com alongside mydomain.com... Can I just make a second project folder, git pull the beta branch there and run it somehow in nginx? Is it possible to divide the nginx requests this way to two "different" projects? -
Populating django m2m field with another model's id
I'm trying to add a new m2m field in my model's serializer but i want the ids to be from another model. voting_members = serializers.PrimaryKeyRelatedField(queryset=Person.objects.all(), many=True) However this throws an assertion error: The field 'voting_member' was declared on serializer NccnPanelSerializer, but has not been included in the 'fields' option. Is there a way to assign another model's ids to a different model serializer's field? -
Id instead of String when displaying foreign key field in DRF
I'm trying to return the name of the "pricing" field but all i get is its foreign key id instead. What am i doing wrong here? Any information on this would be greatly appreciated. I looked at some similiar issues on here but i didn't find anything that resembled my situation. class UserProfileSerializer(serializers.ModelSerializer): class Meta: model = UserProfile fields = ( "assignedteams", "agent", "facility", "organisor", "avatar", ) class UserSubscriptionSerializer(serializers.ModelSerializer): class Meta: model = Subscription fields = ( "user", "pricing", "status", ) class UserSerializer(UserDetailsSerializer): profile = UserProfileSerializer(source="userprofile") subscription = UserSubscriptionSerializer(source="usersubscription") class Meta(UserDetailsSerializer.Meta): fields = UserDetailsSerializer.Meta.fields + ('profile', 'subscription',) def update(self, instance, validated_data): userprofile_serializer = self.fields['profile'] userprofile_instance = instance.userprofile userprofile_data = validated_data.pop('userprofile', {}) usersubscription_serializer = self.fields['subscription'] usersubscription_instance = instance.usersubscription usersubscription_data = validated_data.pop('usersubscription', {}) # update the userprofile fields userprofile_serializer.update(userprofile_instance, userprofile_data) usersubscription_serializer.update(usersubscription_instance, usersubscription_data) instance = super().update(instance, validated_data) return instance -
django template html how to use filter with a context value as a string argument of that filter
i'm try to do smthing like this: {% for i in list %} <td style="background-color: {{color_rule|get_item:i}}">{{i}}</td> {% endfor %} where: def get_item(dictionary, key): return dictionary.get(key) please help -
How to convert between models in django-polymorphic?
I'm using django-polymorphic to model a simple relationship like this: from polymorphic.models import PolymorphicModel class Base(PolymorphicModel): pass class DescendantA(Base): pass class DescendantB(Base): pass I would like to find a way to convert an instance of DescendantA to an instance of DescendantB while keeping the data of its Base part (specifically the primary key). Setting the appropriate __class__ and polymorphic_ctype attributes on the instance (see this answer) works mostly but predictably results in inconsistent data: The database row for DescendantA will not be deleted and continues pointing to the Base row. Is there a clean(er) way to achieve this conversion? I'm inclined to just create a new instance and copy the original data but I hope there's a better way. -
django upload multiple images use form
I'm making a bulletin board. I want to post several images in one post However, no matter how hard I try to find a way to create multiple using the form.I want to upload several files at once. I created an image upload function, but it doesn't show on the web I don't know where it went wrong models.py class Writing(models.Model): author = models.ForeignKey(User, on_delete=models.CASCADE) subject = models.CharField(max_length=200) content = models.TextField() create_date = models.DateTimeField() modify_date = models.DateTimeField(null=True, blank=True) view_count = models.IntegerField(default=0) def __str__(self): return self.subject class WritingImage(models.Model): writing = models.ForeignKey(Writing, on_delete=models.CASCADE) image = models.ImageField(upload_to='images/%Y/%m', blank=True, null=True) forms.py class WritingForm(forms.ModelForm): captcha = ReCaptchaField(label=('로봇확인')) class Meta: model = Writing fields = ['subject', 'content'] labels = { 'subject': '제목', 'content': '내용', } class WritingFullForm(WritingForm): images = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True})) class Meta(WritingForm.Meta): fields = WritingForm.Meta.fields + ['images', ] views.py @login_required(login_url='account_login') def writing_create(request): """ 글작성 """ if request.method == 'POST': form = WritingFullForm(request.POST, request.FILES) files = request.FILES.getlist('images') if form.is_valid(): writing = form.save(commit=False) writing.author = request.user writing.create_date = timezone.now() writing.save() if files: for f in files: WritingImage.objects.create(writing=writing, image=f) return redirect('ourtube:index') else: form = WritingFullForm() context = {'form': form} return render(request, 'ourtube/writing_form.html', context) form.html <div class="form-group"> <label for="note-image">Images</label> <input type="file" name="images" class="form-control-file" id="note-image" multiple> </div> detail.html <h1>{{ writing.view_count … -
why i can't imprt django.db?
enter image description here I installed django on my virtualenv but still I can't import IT. -
ModuleNotFoundError: No module named 'CompanyWebsite' aws hosting
I am trying to use gunicorn during website hosting but keep getting this error. Everything seems fine according to me .Read many solutions but couldnot find the issue (venv) ubuntu@ip-172-31-45-195:~$ cd project (venv) ubuntu@ip-172-31-45-195:~/project$ cd Company-Website (venv) ubuntu@ip-172-31-45-195:~/project/Company-Website$ cd CompanyWebsite (venv) ubuntu@ip-172-31-45-195:~/project/Company-Website/CompanyWebsite$ ls __init__.py __pycache__ asgi.py settings.py urls.py wsgi.py (venv) ubuntu@ip-172-31-45-195:~/project/Company-Website/CompanyWebsite$ gunicorn wsgi When i run wsgi file i get this error [2022-07-19 13:57:40 +0000] [8638] [INFO] Starting gunicorn 20.1.0 [2022-07-19 13:57:40 +0000] [8638] [INFO] Listening at: http://127.0.0.1:8000 (8638) [2022-07-19 13:57:40 +0000] [8638] [INFO] Using worker: sync [2022-07-19 13:57:40 +0000] [8639] [INFO] Booting worker with pid: 8639 [2022-07-19 13:57:40 +0000] [8639] [ERROR] Exception in worker process . . . ModuleNotFoundError: No module named 'CompanyWebsite' My wsgi file is: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CompanyWebsite.settings') application = get_wsgi_application() Please help me to solve this issue -
How to do a DELETE/UPDATE at the same time? Django rest ramework
I'm new with django rest framework and I have 4 fields in my database table (id, chip, creation date, deletion date), on the front-end there is a button to delete the chip, so far so good, but on the page I have, in addition to the abject (chip) to be deleted, it has 2 more fields (creation date and deletion date) when deleting the object, the deletion date field must have the time of deletion and not simply be empty. How to make this change when doing the deletion?` at the moment I just created the model and migrated it to the database. I haven't started yet, I just created a route to list (GET) all the data in the table. I ask for help to do the Delete/Update or whatever it may be. my model class Gateway(models.Model): id = models.AutoField( primary_key=True) gateway_chip = models.CharField(max_length=20, unique=True) creation_date = models.DateTimeField() deletion_date = models.DateTimeField() class Meta: db_table = 'GATEWAY' -
How to test a custom middleware in django?
class VersionCheckMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): meta = request.META client_data = VersionChecks.get_meta_info(meta) client = client_data.get('client') backward_compatibility = {} last_compatible_pwa_version = backward_compatibility.get('last_supported_pwa_version', 823) if client == APP_TYPES.consumer_web: pwa_version = int(client_data.get('client_version', 0)) native_version = int(client_data.get('platform_version', 0)) if pwa_version < last_compatible_pwa_version: return JsonResponse(UNSUPPORTED_APP_VERSION, status=400) response = self.get_response(request) return response I have written this custom middleware, how can i unit test this? This is my test code class TestVersionCheckMiddleware(unittest.TestCase): @patch('misc.middlewares.version_check_middleware.VersionCheckMiddleware') def test_init(self, version_check_middleware_mock): vcm = VersionCheckMiddleware('response') assert vcm.get_response == 'response' def test_version_check_middleware(self): mock_request = Mock() mock_request.META = { "HTTP_X_APP_CLIENT": 21, "HTTP_X_APP_PLATFORM": 21, "HTTP_X_APP_PLATFORM_VERSION": 23, "HTTP_X_APP_VERSION": 32, "app_version": 323, } vcm_middleware_response = VersionCheckMiddleware() assert vcm_middleware_response.get_response == (UNSUPPORTED_APP_VERSION, 400) This test case does not actually calls the middleware, how can i properly test this middleware? Any resources about how can i solve this, please do share that as well -
How do I authorize a specific url to load the content of my site deployed on heroku from an iframe?
I deployed my site designed in Python Django on heroku. When I try to access this site through an iframe from an html file of my own design, I get the error: https://gkwhelps.herokuapp.com refused connection. This site contains the default header: X-Frame-Options: DENY , After looking on the Django documentation, I saw that this property only accepts two options DENY or SAMEORIGIN. I wonder if there is not a way to allow access to this site via an iframe from a domain name or the localhost. -
when building python Django project it exiting with an error
i am getting below error when building the project. I have installed pymssql using pip -m install pymssql and visual studio installer as well. tree = Parsing.p_module(s, pxd, full_module_name) building '_mssql' extension creating build creating build\temp.win-amd64-cpython-39 creating build\temp.win-amd64-cpython-39\Release creating build\temp.win-amd64-cpython-39\Release\src "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\anallamilli\AppData\Local\Temp\pip-install-_ebszunz\pymssql_8c3eaa8f4e074feda79e1cd9e7617f9e\freetds\vs2015_64\include -IC:\Users\anallamilli\AppData\Local\Temp\pip-install-_ebszunz\pymssql_8c3eaa8f4e074feda79e1cd9e7617f9e\build\include "-Ic:\users\anallamilli\onedrive - fireangel\desktop\local build\admin_v2_pipeline\comp_admin_system\env1\include" -IC:\Users\anallamilli\AppData\Local\Programs\Python\Python39\include -IC:\Users\anallamilli\AppData\Local\Programs\Python\Python39\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc\_mssql.c /Fobuild\temp.win-amd64-cpython-39\Release\src\_mssql.obj -DMSDBLIB _mssql.c src\_mssql.c(699): fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. WARNING: No metadata found in c:\users\anallamilli\onedrive - fireangel\desktop\local build\admin_v2_pipeline\comp_admin_system\env1\lib\site-packages Rolling back uninstall of pymssql Moving to c:\users\anallamilli\onedrive - fireangel\desktop\local build\admin_v2_pipeline\comp_admin_system\env1\lib\site-packages\pymssql-2.2.5.dist-info from C:\Users\anallamilli\OneDrive - FireAngel\Desktop\Local build\Admin_V2_Pipeline\COMP_Admin_System\env1\Lib\site-packages~ymssql-2.2.5.dist-info Moving to c:\users\anallamilli\onedrive - fireangel\desktop\local build\admin_v2_pipeline\comp_admin_system\env1\lib\site-packages\pymssql from C:\Users\anallamilli\OneDrive - FireAngel\Desktop\Local build\Admin_V2_Pipeline\COMP_Admin_System\env1\Lib\site-packages~ymssql error: legacy-install-failure Encountered error while trying to install package. pymssql note: This is an issue with the package mentioned above, not pip. hint: See above for output … -
What do I set the default value as when adding a field to a model?
I added the field user which is a foreign key to another model called User. This field was added to the model called Bid. However, when I tried to migrate the changes, I got the message: It is impossible to add a non-nullable field 'user' to bid without specifying a default. This is because the database needs something to populate existing rows. Please select a fix: 1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 2) Quit and manually define a default value in models.py. Last time, I set it to 'user' and got an error that stated: ValueError: invalid literal for int() with base 10: 'user'. What should I set the default value as? models.py: class Bid(models.Model): item = models.ForeignKey(Listing, on_delete=models.CASCADE) price = models.FloatField() user = models.ForeignKey(User, on_delete=models.CASCADE) -
Podcasting with Django
I am building a website with the Django framework; I want this website to load podcasts from Anchor.FM. I am looking for a way to load all my podcast series automatically but I don't know how to go about this using Django?