Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to use Django-simple-captcha on the admin login page?
I would like to add captcha on my django login form using Django Simple Captcha found here: http://code.google.com/p/django-simple-captcha/ This works great if you create a new form but I'm using the django.contrib.auth.forms the one that comes with django. Any idea how I might be able to implement captcha with the existing django auth views? Thank you! Please do not suggest using Google reCaptcha. My urls.py from django.contrib.auth import views as auth_views urlpatterns = [ path('login/', auth_views.LoginView.as_view(template_name='login.html'), name='login') ,... ] My login.html <form class="fadeIn second" method="post"> {% csrf_token %} {{ form.as_p }} <button type="submit" class="btn btn-primary"> Login </button> </form> My Forms.py from captcha.fields import CaptchaField class MyFormCaptcha(forms.Form): captcha = CaptchaField() -
Why all the tags not displaying in home.html page?
So here's the problem, I'm trying to display all the tags on the homepage in a dropdown menu but the tags are not being called in base.html. But when I open the specific post itself, the Dropdown menu displays the tags used in that post. Why is that? Can't the tags used in each post be passed on to all pages? Btw I'm using Django-taggit for it. My views.py goes like this: def home(request, tag_slug=None): posts = Post.objects.all() # tag post tag = None if tag_slug: tag = get_object_or_404(Tag, slug=tag_slug) posts = posts.filter(tags__in=[tag]) context={ 'posts': posts, #introduces the content added in Post Class 'tag':tag, } return render(request, 'blog/home.html', context) And my urls.py goes like this: urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), path('tag/<slug:tag_slug>/',views.home, name='post_tag'), ] My base.html goes like this: <li class="list-group-item list-group-item-light" style="text-align:center"> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Tags </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> {% for tag in post.tags.all %} <a class="dropdown-item" href="{% url 'post_tag' tag.slug %}">{{tag.name}}</a> {% endfor %} </div> </div> </li> -
How to add margin in forms in django admin panel
Is there any way to add margin between forms in django admin panel, because my admin panel looks so cramped without any margin i can control -
Attribute Error: Object has no Attributes while trying to update the manytoo
Attribute Error: Object has no Attributes "avg_rating" Errors occurs while trying to update the ManytooOne Field in views.py perform_create func. Imm trying to update a avg_rating which is instance of Review model, Every time an a comment is received. my review is related to watchlist through foreign key. Here's my models.py class WatchList(models.Model): title = models.CharField(max_length=50) storyline = models.CharField(max_length=200) active = models.BooleanField(default=True) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title class Review(models.Model): username = models.ForeignKey(User, on_delete=models.CASCADE) rating = models.PositiveIntegerField(validators = [MinValueValidator(1), MaxValueValidator(5)]) comment = models.CharField(max_length=200, null=True) watchlist = models.ForeignKey(WatchList, on_delete=models.CASCADE, related_name="reviews") avg_rating = models.FloatField(default=0) num_rating = models.IntegerField(default=0) active = models.BooleanField(default=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) def __str__(self): return self.comment serializer.py class ReviewSerializer(serializers.ModelSerializer): username = serializers.StringRelatedField(read_only=True) class Meta: model = Review exclude = ["watchlist"] class WatchListSerializer(serializers.ModelSerializer): ### using relation serializer to list all the reviews in a movie reviews = ReviewSerializer(many=True, read_only=True) class Meta: model = WatchList fields = "__all__" views.py class ReviewCreateView(generics.CreateAPIView): serializer_class = ReviewSerializer permission_classes = [IsAuthenticated] def get_queryset(self): return Review.objects.all() def perform_create(self, serializer): ##posting the comment in a movie using movies primary key primary_key = self.kwargs.get("pk") watchlist = WatchList.objects.get(pk=primary_key) #NOt allowing the same user to comment on the same movie twice username = self.request.user review_queryset = Review.objects.filter(watchlist=watchlist, username=username) … -
Use Set of Choices as the order_by
class OrganizationAccount(AbstractUser): OrgRole = [('President', 'President'),('Internal VP', 'Internal Vice President'), ('External VP', 'External Vice President'), ('Treasurer', 'Treasurer'), ('Secretary', 'Secretary'), ("Assistant Secretary", "Assistant Secretary"), ("Auditor", "Auditor"), ("Outreach Program Director", "Outreach Program Director"), ("Event Coordinator", "Event Coordinator"), ("Public Information Officer", "Public Information Officer"), ("Digital Officer", "Digital Officer"), ("Representative", "Representative"), ('Member', 'Member') ] role = models.CharField(choices = OrgRole, max_length=32) I'm looking for a way to call OrganizationAccount.objects.all().order_by('OrgRole') In a sense that it would produce a query set in this order (Pres, Internal VP, External VP, ...) Is there any way to execute this? -
Cpanel Django ERR_TOO_MANY_REDIRECTS on Admin/Auth/User and Admin/Auth/Group Pages
I'm doing a project for a client using Django and have finally installed it on CPanel. Everything seems to be working great, but when I try to access the admin panel, the tables group or user has an error because it says it's doing a lot of redirections. In the admin panel, I just have this: When I try to register something, it loads the page, like this: But when I try to access the tables, it shows me an ERR_TOO_MANY_REDIRECTS, as shown in the following picture: It basically says that it's not working and to try to delete my cookies. I did that, and nothing worked. In the urls.py I only have the admin path so the redirection problem is not from something I miscofigured there. I haven't modified the installation parameters for settings.py besides the Allowed_Host variable to allow the URL of the page, the database connection using PostgreSQL and its working, and the variables of the static files are also working. So I'm feeling deadlocked because I can't find an answer to this and I don't believe I'm the first one experiencing this. If someone knows anything, please let me know. -
How can i limit the number of objects we can save by with a condition and without a condition in django?
What is meant is, I want to save only one object with is_featured field true, if user tried to save another object with is_featured field true it needs to give a prompt, How can i accomplish that in django any idea? class Event(BaseModel): title = models.CharField(max_length=200) time = models.TimeField() date = models.DateField() location = models.CharField(max_length=200) location_url = models.URLField() description = models.TextField() is_featured = models.BooleanField(default=False) image = VersatileImageField('Image', upload_to="web/events") class Meta: db_table = 'web_event' verbose_name = ('Event') verbose_name_plural = ('Event') ordering = ('auto_id',) def __str__(self): return str(self.title) -
Firebase Cloud Messaging registration token - Flutter and Django
I am trying to send push notifications (iOS, Android, Web) to specific users when certain events happen in my app. I am using the firebase_admin python plugin with Django, working properly for authentication and verifying jwt, but it is giving me this error when trying to send a Message/Notification from Django: firebase_admin.exceptions.InvalidArgumentError: The registration token is not a valid FCM registration token I am getting the token directly from my Flutter instance and sending it in the request body from Flutter to Django. My method for getting the token from Flutter: await FirebaseMessaging.instance.getToken().then((token) async { fcm_token = token!; }).catchError((e) { print(e); }); My python code that sends notification: registration_token = self.context['request'].data["token"], # See documentation on defining a message payload. message = Message( notification=Notification( title='New Product Added', body='A new product called ' + validated_data['name'] + ' has been added to your account.', ), token=str(registration_token) ) # Send a message to the device corresponding to the provided # registration token. response = send(message) I have verified that the token being passed to Django is correct, by comparing it to what I am getting from Flutter -
Building chart using charjs in Django
I need to create a chart with chartjs with displaying month wise count on current year in a line chart. The data should be retrieved from the model named "invoice" and the feild name is "Invoice_date". Note: Invoice_date is an DateFeild(). in views.py def home(request): if request.user.is_authenticated: customers = User.objects.filter(groups__name='Customer').count() totalinvoice = invoice.objects.all().count() supplier = User.objects.filter(is_staff=True).count() # chart labels = ["Jan","Feb","Mar","Apr","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] data = [12,14,19,25,28,80,23,35,46,78,45,23] // This data's should be retrieved dynamically return render(request, 'home.html', { 'totalinvoices':totalinvoice, 'customers':customers, 'supplier':supplier, "labels":json.dumps(labels), "data":json.dumps(data), }) else: return redirect("login") Please someone help me in figuring out. -
Django: How can I show the name instead of the id in the list?
I have a form to create a user, when displaying the data in the list the foreign keys are shown with the id, how can I make the name appear instead of the id? I'm trying to do it with a for inside the template but it doesn't show me anything my user table has the cargo_empleado table as a foreign key and inside the cargo_empleado table I have a column called nombre_cargo, the column nombre_cargo I want to be displayed instead of the id template <td class="ps-0 pe-0"> {% for cargo_empleado in request.user.cargo_empleado %} {% if cargo_empleado.nombre_cargo == 'funcionario' %} <a href="" class="btn btn-info btn-sm no-hover" style="cursor: default; border-radius: 2rem; pointer-events: none;">Funcionario</a> {% endif %} {% if cargo_empleado.nombre_cargo == 'diseñador' %} <a href="" class="btn btn-warning btn-sm no-hover" style="cursor: default; border-radius: 2rem; pointer-events: none;">Diseñador</a> {% endif %} {% endfor %} <!-- {% if display.7 == 1 %} <a href="" class="btn btn-info btn-sm no-hover" style="cursor: default; border-radius: 2rem; pointer-events: none;">Funcionario</a> {% else %} <a href="" class="btn btn-warning btn-sm no-hover" style="cursor: default; border-radius: 2rem; pointer-events: none;">Diseñador</a> {% endif %} --> </td> -
Web Application Technologies and Django, (string that looks like 53656C696E613333) 2022
my wish is to know exactly what are asking for in this part of the final exercise of week 5 of the course (Web Application Technologies and Django University of Michigan). enter image description here enter image description here I understand that I have to run the above in pythonanywhere and... 1) I don't know if I have to enter the same code written there in the text box above, 2) I have to enter the outputs of said code in the text box, 3) I have to enter in the text box the code corresponding to the question shaded in blue in the image or its output or the code of the question with the output??? Besides, if possible, I would like to know what exactly asks that question. I don't know if I should update the first value of the table so that its hexadecimal (name, age) returns that "53656C696E613333" or something else. I appreciate the help. -
Each child in a list should have a unique "key" prop error with uuid as key react
I'm getting an "Each child in a list should have a unique "key" prop." in console here specifically (it quotes the first line as the relevant line) <Dropdown.Menu variant="dark"> {[ [0, "prod_name", "Name"], [1, "price", "Price"], [2, "average_rating", "Rating"], ].map((item, i) => ( <> <Dropdown.Item as={Button} key={uuid.v4()} onClick={() => { this.setState({ sort: item[0], open: false }); this.context.sort(item[1], "asc"); }} className={ this.state.sort === item[0] ? "text-black giBold active" : "text-light" } > {item[2] + " (ascending)"} </Dropdown.Item> <Dropdown.Item as={Button} key={uuid.v4()} onClick={() => { this.setState({ sort: item[0] + 3, open: false }); this.context.sort(item[1], "desc"); }} className={ this.state.sort === item[0] + 3 ? "text-black giBold active" : "text-light" } > {item[2] + " (descending)"} </Dropdown.Item> </> ))} </Dropdown.Menu>; I changed the key to be uuid since I realised tonnes of id's of different items are going to be the same in hopes that it would fix the error yet it keeps popping up. Is there something else at play here that I've missed, I tried looking for answers but couldn't find much. -
Save multiple files in a database with multiple submit buttons on a single html page
I am building a website in python django and I am new to this. Is there a way I can save multiple files with multiple submit buttons on the same html page. I created a table to store them separately. Any assistance would be appreciated. -
websockets with Django channels rest framework in docker-compose
I've made an application with two websockets connections using Django channels rest framework. Locally, everything works fine. I have such settings: #routing.py from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter from django.core.asgi import get_asgi_application from django.urls import re_path from gnss.consumers import CoordinateConsumer # noqa from operations.consumers import OperationConsumer # noqa websocket_urlpatterns = [ re_path(r'ws/coordinates/', CoordinateConsumer.as_asgi()), re_path(r'ws/operations/', OperationConsumer.as_asgi()), ] application = ProtocolTypeRouter({ 'http': get_asgi_application(), 'websocket': AuthMiddlewareStack( URLRouter(websocket_urlpatterns) ), }) # consumers.py from djangochannelsrestframework.decorators import action # noqa from djangochannelsrestframework.generics import GenericAsyncAPIConsumer # noqa from djangochannelsrestframework.observer import model_observer # noqa from djangochannelsrestframework.observer.generics import action # noqa from djangochannelsrestframework.permissions import AllowAny # noqa from .models import Coordinate from .serializers import CoordinateSerializer class CoordinateConsumer(GenericAsyncAPIConsumer): queryset = Coordinate.objects.all() serializer_class = CoordinateSerializer permission_classes = (AllowAny,) @model_observer(Coordinate) async def coordinates_activity(self, message, action=None, **kwargs): await self.send_json(message) @coordinates_activity.serializer def coordinates_activity(self, instance: Coordinate, action, **kwargs): return dict(CoordinateSerializer(instance).data, action=action.value, pk=instance.pk) @action() async def subscribe_to_coordinates_activity(self, request_id, **kwargs): await self.coordinates_activity.subscribe(request_id=request_id) As for the consumers.py for the ws/operations/ it's exactly the same. When I run my Django app on local machine in development server (python manage.py runserver) everything works fine. But for some reason, when I run my app in docker-compose, ws/operations/ works, but ws/coordinates not. I don't recieve messages from Django for … -
django: How to write JavaScript fetch for url with slug parameter?
A django and async newbie here, trying to improve a simple message-board app. I'm sure you've all seen this problem dozens of times, but I'm unable to find a solution... Currently, when a user likes a posted message, it refreshes the whole page. I'd like to use simple JavaScript with the fetch API to prevent this, without having to resort to Ajax, as I've never used it. The problem is, I'm very new to the fetch method as well and I'm struggling to find the correct syntax for the url in the fetch request, as it uses the post model's slug field as a parameter. Like so: urls.py urlpatterns = [ ... path('post/<slug:slug>/', views.FullPost.as_view(), name='boards_post'), path('like/<slug:slug>/', views.PostLike.as_view(), name='post_like'), ... ] models.py ... class Post(models.Model): """ Model for message posts """ STATUS = ((0, "Draft"), (1, "Published")) title = models.CharField(max_length=200, unique=True) slug = models.SlugField(max_length=200, unique=True) author = models.ForeignKey( User, on_delete=models.CASCADE, related_name="board_posts" ) category = models.ForeignKey( Category, on_delete=models.CASCADE, default="", related_name="category_posts" ) created_on = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField(auto_now=True) content = models.TextField() post_image = CloudinaryField('image', default='placeholder') status = models.IntegerField(choices=STATUS, default=0) likes = models.ManyToManyField(User, related_name="post_likes") class Meta: # Orders posts in descending order ordering = ['-created_on'] def __str__(self): return self.title def number_of_likes(self): return self.likes.count() def … -
URL to redirect related model instance django
I have a 2 models with ForeignKey linked to each other class Moc(models.Model): title = models.CharField(max_length=128, blank=False) scope = models.TextField(max_length=128, blank=False) .... def __str__(self): return self.title class Verifier(models.Model): moc = models.ForeignKey(Model1, related_name='verifiers' on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE) approve = models.BooleanField(default=False). reject = reject = models.BooleanField(default=False) .... def __str__(self): return str(self.id) I have a respective forms, views and templates to create, update, delete records. def verifier_signoff_view(request, pk): verifier = Verifier.objects.get(pk=pk) form = VerifierSignForm if request.method == 'POST': form = VerifierSignForm(request.POST, instance=verifier) if form.is_valid(): form.save(commit=False) if verifier.approve is True and verifier.reject is True: return HttpResponseForbidden('You have either APPROVE or REJECT - operation not allowed!') else: form.save() return redirect('verify_coorinate' pk=verifier.moc_id) # This is where I need help... else: return render(request, 'moc/verify_signoff.html', context={'verifier': verifier, 'form': form}) What I want is that after I update Model2 instance as per above view, I want to redirect back to Model1 instance rather than verifier instance. Any help please... -
Django - formset working with multiple forms
I have three different models illustrated as below and I want to be able to edit three different forms in formset. models.py class Parent(models.Model): parent_name = models.CharField(max_length=20) class Child(models.Model): child_name = models.CharField(max_length=20) parent = models.ForeignKey("Parent",on_delete=models.PROTECT) birth_place = models.OneToOneField("BirthPlace", on_delete=models.PROTECT) class BirthPlace(models.Model): place_name = models.CharField(max_length=20) forms.py ChildrenFormset = inlineformset_factory(Parent, Child, fields='__all__', extra=0) So far, I have managed to create a formset where I can work with Parent and Child. Also, in html, I have written some javascript to add a child form dynamically. Now the problem is embedding form for BirtPlace. I have tried the below: def add_fields(self, form, index): super(ChildrenFormset, self).add_fields(form, index) form.initial['birth_place_name']=form.instance.birthplace.place_name However, it throws RelatedObjectDoesNotExist. Can you please help? Thanks -
pip не устанавливает channels_redis
Я не могу установить channels_redis с помощью pip. Using legacy 'setup.py install' for hiredis, since package 'wheel' is not installed. Installing collected packages: hiredis, async-timeout, aioredis, channels_redis Running setup.py install for hiredis ... error error: subprocess-exited-with-error × Running setup.py install for hiredis did not run successfully. │ exit code: 1 ╰─> [17 lines of output] C:\Users\Илья\AppData\Local\Temp\pip-install-dmtn5wae\hiredis_fe10fb4a81324558bcaf79034747e0f0\setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses import sys, imp, os, glob, io C:\Users\Илья\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( running install running build running build_py creating build creating build\lib.win-amd64-3.10 creating build\lib.win-amd64-3.10\hiredis copying hiredis\version.py -> build\lib.win-amd64-3.10\hiredis copying hiredis_init_.py -> build\lib.win-amd64-3.10\hiredis copying hiredis\hiredis.pyi -> build\lib.win-amd64-3.10\hiredis copying hiredis\py.typed -> build\lib.win-amd64-3.10\hiredis running build_ext building 'hiredis.hiredis' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> hiredis note: This is an issue with the package mentioned above, not pip. hint: … -
No module named 'requests' - Django deployment onto Heroku
Deployed some new code into an app on Heroku and now showing the following message: No module named 'requests' . The app was working fine before, so this has to be something I changed. Before I show the code there is 2 things that I noticed: my Procfile & requirements files are not visible from Visual Studio (can be seen from Sublime Text Editor). Recently started using VS and only noticed it now. Not sure if this is of importance here. I am not sure where the error is coming from so I left below traceback, Procfile and requirements.txt files. Let me know if I need to add something else. Traceback $ git push heroku master Enumerating objects: 111, done. Counting objects: 100% (111/111), done. Delta compression using up to 4 threads Compressing objects: 100% (80/80), done. Writing objects: 100% (81/81), 129.38 KiB | 2.59 MiB/s, done. Total 81 (delta 23), reused 1 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Using buildpack: heroku/python remote: -----> Python app detected remote: -----> No Python version was specified. Using the same version as the last build: python-3.10.5 remote: … -
NGINX giving me `ERR_TOO_MANY_REDIRECTS` in the browser, but no error is showing in the terminal
I have a set up a nginx on subdomain backend.globeofarticles.com, and the frontend is served on cloudfare on domain www.globeofarticles.com and globeofarticles.com, also my code for the backend is deployed on a vps, the frontend is deployed on cloudfare, the main problem is that nginx is giving me ERR_TOO_MANY_REDIRECTS on the browser, screenshot: here is some code that might help tracking the problem: on /etc/nginx/nginx.conf file : user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # SSL Settings ## ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; # gzip_vary on; # gzip_proxied any; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/x$ ## # Virtual Host Configs ## # # EDIT HERE include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; … -
Sharing user profiles in two Django projects
I was wondering if it possible to create two Django website Both work independently. If the User signup on site A The new contact information will be sent to site B using API automatically. If the user adds a post on site A, site B gets its copy. Site B is the parent of multiple sites like site A owned by users. The users create something on their local site, and B gets a copy of the user push. I'm looking to create a federated network of multiple social websites and a Base website for the storing of Public posts only. -
Django editing view/template for Froala form
I wanna use Froala editor form for creating and editing articles in my site. I can create any article with this form/can get data from editor, but i don't know how to insert article data from DB through view function into {{ form }} in my template. How to do this? -
"local variable 'form_b' referenced before assignment django"
def register(request): if not request.user.is_authenticated: if request.POST.get('submit') == 'sign_up': form = RegisterForm(request.POST) if form.is_valid(): form.save() form = RegisterForm() elif request.POST.get('submit') == 'log_in': form1 = LogInForm(request=request, data=request.POST) if form1.is_valid(): uname = form1.cleaned_data['username'] upass = form1.cleaned_data['password'] user = authenticate(username=uname, password=upass) if user is not None: login(request, user) return redirect('/') else: form_b = LogInForm() form = RegisterForm() return render(request, 'auth.html', {'form': form, 'form1': form_b}) This above is my view function <form class="loginForm" action="" method="POST" novalidate> {% csrf_token %} {% for field in form %} <p> {{field.label_tag}} {{field}} </p> {% endfor %} <button type="submit" class="btnLogin" name='submit' value='sign_up'>Sing Up</button> </form> <form class="loginForm" action="" method="post" novalidate> {% csrf_token %} {% for field in form1 %} <p> {{field.label_tag}} {{field}} </p> {% endfor %} <button class="btnLogin" type="submit" name='submit' value='log_in'>Log In </button> </form> rendering two forms in a view function code is working fine but when i click on signup this error occur which says "local variable 'form_b' referenced before assignment django" -
/o/token is not working in django oauth2_provider
I have setup django setup locally with oauth2_provider toolkit, right now https://{domain}/o/applications/ url is working fine, but when I went through documentation I found out oauth2_provider has few more inbuilt URL's like base_urlpatterns = [ re_path(r"^authorize/$", views.AuthorizationView.as_view(), name="authorize"), re_path(r"^token/$", views.TokenView.as_view(), name="token"), re_path(r"^revoke_token/$", views.RevokeTokenView.as_view(), name="revoke-token"), re_path(r"^introspect/$", views.IntrospectTokenView.as_view(), name="introspect"), ] management_urlpatterns = [ # Application management views re_path(r"^applications/$", views.ApplicationList.as_view(), name="list"), re_path(r"^applications/register/$", views.ApplicationRegistration.as_view(), name="register"), re_path(r"^applications/(?P<pk>[\w-]+)/$", views.ApplicationDetail.as_view(), name="detail"), re_path(r"^applications/(?P<pk>[\w-]+)/delete/$", views.ApplicationDelete.as_view(), name="delete"), re_path(r"^applications/(?P<pk>[\w-]+)/update/$", views.ApplicationUpdate.as_view(), name="update"), # Token management views re_path(r"^authorized_tokens/$", views.AuthorizedTokensListView.as_view(), name="authorized-token-list"), re_path( r"^authorized_tokens/(?P<pk>[\w-]+)/delete/$", views.AuthorizedTokenDeleteView.as_view(), name="authorized-token-delete", ), ] But in my case I am not able to access https://{domain}/o/token/ -
Django migrations RunPython reverse function
In the documentation there is a mention of a reverse function in RunPython in django migrations https://docs.djangoproject.com/en/4.0/ref/migration-operations/#runpython When does the reverse function run? Is there a specific command to run the reverse function?