Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Fixtures - Working with many to many intermediary models
I am training myself on Django and working on a movie blog and have issues with my fixtures that I scrap from themoviedb's api. I am wondering the right way to insert a ManyToMany with intermediary model. Here is my current state (removing the useless fields): class Movie(models.Model): tmdb_id = models.AutoField(primary_key=True) original_title = models.CharField(max_length=255) actors = models.ManyToManyField(Person, through='Actor', related_name="movie_cast") staffs = models.ManyToManyField(Person, through='Staff', related_name="movie_staff") class Actor(models.Model): person = models.ForeignKey(Person, on_delete=models.CASCADE) movie = models.ForeignKey(Movie, on_delete=models.CASCADE) role = models.CharField("person's role in a movie", max_length=40) class Staff(models.Model): person = models.ForeignKey(Person, on_delete=models.CASCADE) movie = models.ForeignKey(Movie, on_delete=models.CASCADE) department = models.CharField(max_length=30) job = models.CharField("person's job in a movie", max_length=40) What I am doing now is insert manualy a model.actor or model.staff like this to the fixture. {"model": "blog.actor", "fields": { "person": people['id'], "movie": movie['id'], "role": people['character'], } } I try to pass this dict or just the additional field to movie.actor field but it needs a int foreign key. Am I doing right or there is a better way to do this ? Thanks. -
View Model class in Django
I want to make a view model class in Django whose main purpose is only to display data in templates. like I have an auction model which has the following properties: class Auction(models.Model): seller = models.ForeignKey(User, on_delete=models.CASCADE) title = models.CharField(max_length=500) description = models.CharField(max_length=4000) edit_token = models.CharField(max_length=500) starting_price = models.DecimalField(max_length=30, max_digits=19, decimal_places=2) bid_price = models.DecimalField(max_length=30, max_digits=19, decimal_places=2, null=True) winner_id = models.IntegerField(null=True) end_date = models.DateTimeField(blank=True) status = models.CharField(max_length=15, choices=STATUS__CHOICES, default='Active') revision = models.IntegerField(default=1) Now I only want to show title, description, starting_price etc to view and main purpose of the view model is I want to change the value of starting_price based on user currency selection so I wanted to add some business logic during the transformation of Database Model class to Template Model class. Can I use form models or are there any other models I can use? -
Django Static image not displaying while using block
I am using Django, I am trying to display the image but I am getting the error. Invalid block tag on line 35: 'static', expected 'endblock'. Did you forget to register or load this tag? If I added my image directly on index.html page then the image is displaying but when I am using extends and block to display then I am getting the error. setting.py STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR,'static'), ) home.html {% extends 'demo1/index.html' %} {% block content %} <img src="{% static 'images/web/landing-page.png' %}" alt="Landing Page"> { % endblock %} index.html {% load static from staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>{% block title%}Home{% endblock %}</title> <link rel="stylesheet" href="{% static 'css/style.css'%}" type="text/css"> </head> <body> {% block content %} {% endblock %} </body> </html> -
Django post_save signal not saving
I have a custom user class and some of my users require automatic username generation so naturally I felt a post or pre save signal would be best to generate what was needed. I opted for post_save because I wanted to append the pk to the generated username @receiver(post_save, sender=CustomUser) def make_username(sender, instance, created, using, **kwargs): if created: if instance.is_resident: instance.username = f'{instance.first_name[0]}{instance.last_name}{instance.id}' print(instance.username) # is correct # instance.save(), can do this but why do I need to? My issue is that the instance username is not being saved when the signal is called but everything prints out as expected as shown above. I cannot seem to figure out what is going on. I can save the instance again as I show in the comments, but I'm not understanding why it is needed. Can someone explain what my issue is here? Here is my CustomUser class if anyone needs to see it. class CustomUser(AbstractUser, SafeDeleteModel): objects = CustomUserManager() middle_name = models.CharField(max_length=100, null=True, blank=True) is_admin = models.BooleanField(default=False) is_corporate = models.BooleanField(default=False) is_onsite_manager = models.BooleanField(default=False) is_onsite_staff = models.BooleanField(default=False) is_maintenance = models.BooleanField(default=False) is_security = models.BooleanField(default=False) is_resident = models.BooleanField(default=False) # email = models.EmailField(unique=True) phone = models.CharField(max_length=100, validators=[validate_phone]) first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) revoked_permissions = … -
How am I able to display my comment replies in Django
I have a system where users can make posts, and I have recently made it so users can reply to these comments. However, they won't display. Here is some code. VIEWS.PY @login_required(login_url='/mainapp/user_login/') def add_comment_to_post(request,pk): post = get_object_or_404(Post,pk=pk) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.post = post comment.author = request.user # add this line comment.save() return redirect('mainapp:post_detail',pk=post.pk) else: form = CommentForm() return render(request,'mainapp/comment_form.html',{'form':form}) def get_queryset(self): return Comment.objects.filter(created_date__lte=timezone.now()).order_by('-created_date') @login_required(login_url='/mainapp/user_login/') def add_reply_to_comment(request,pk): comment = get_object_or_404(Comment,pk=pk) if request.method == 'POST': form = ReplyForm(request.POST) if form.is_valid(): reply = form.save(commit=False) reply.comment = comment reply.author = request.user reply.save() return redirect('mainapp:post_detail',pk=comment.pk) else: form = ReplyForm() return render(request,'mainapp/reply_form.html',{'form':form}) def get_queryset(self): return Reply.objects.filter(created_date__lte=timezone.now()).order_by('-created_date') Those are my views for adding a comment to a post and a view to a post. The urls.py and models.py don't need changing, since this does work, and it shows in the admin interface and all, however I don't know how to display it in my HTML {% for comment in post.comments.all %} {% if user.is_authenticated or comment.approved_comment %} <p>Posted by: <strong>{{ comment.author }}</strong></p> <p id="comment-text">{{ comment.text|safe|linebreaks }}</p> <p>{{ comment.created_date|timesince }} ago</p><br> {% endif %} {% for reply in comment.replys %} <p>Posted by: <strong>{{ reply.author }}</strong></p> <p id="comment-text">{{ reply.text|safe|linebreaks }}</p> … -
create absolute url for static files in django
I am using django rest framework tinymce for tutorial upload website. This is working but when I am sending data by API, youtube URLs and image URLs are passing like this: <iframe src="//www.youtube.com/embed/IFncZA5k_1k" width="560" height="314" ></iframe> <img src="../../../../../media/uploads/yoga_m.jpg" alt="" /> I need absolute URLs in HTML response -
404 while trying to generate pdf with reportlab
I am trying to implement option to generate pdf file for download from views.py. For now I am using sample code provided in django docs however for some reason when I try to generate sample pdf I get 404 error with message that: The current path, stv/DRG_result, didn't match any of these. --bunch of urls paths-- The current path, stv/DRG_result, didn't match any of these. That seems logical, because I did not set any path in urls.py for that (since there was no info that it is needed). Should I set it? Can somebody tell me how to do it correctly, since I am very new to django. Or error is somewhere else? My relevant views.py part: import io from django.http import FileResponse from reportlab.pdfgen import canvas def DRG_result(request): buffer = io.BytesIO() p = canvas.Canvas(buffer) p.drawString(100, 100, "hello world.") p.showPage() p.save() buffer.seek(0) return FileResponse(buffer, as_attachment=True, filename='hello.pdf') Code part for the button from the template which calls this function: <form action='DRG_result' method='GET'> {% csrf_token %} <button type="submit" >Generuoti PDF</button> </form> -
Redis, Django, Windows - "Warning: no config file specified, using the default config... 'redis-server /path/to/redis.conf'"
I'm trying to create a Celery task for my Django application. I do it according to this tutorial. According to him "Redis as the message broker" between Django Project and the Celery workers I found documentation on how to install redis on windows: https://redislabs.com/ebook/appendix-a/a-3-installing-on-windows/a-3-2-installing-redis-on-window/ According to him, I download project redis-2.4.5-win32-win64.zip from GitHub and unpacked from ZIP. Now I am trying to run the file redis-server by double clicking on the appropriate file. This launches a window that disappears for a second. When I trying to stop this window, I see this message. How can I resolve this error to properly start the redis server on windows? I will add that the redis.conf file is in the same position as you can see in the attached picture. I also can't use the redis-server /path/to/redis.conf command because the window redis-server closes automatically. Any help will be appreciated. -
Django Ajax form validation
I want to do ajax form validation to display errors. I looked at many examples, but some are old and do not work, while others I do not understand.Below is the code, please help with the implementation of ajax requests. views.py def register(request): if request.method == 'POST': user_form = UserRegistrationForm(request.POST) if user_form.is_valid(): # Create a new user object but avoid saving it yet new_user = user_form.save(commit=False) # Set the chosen password new_user.set_password(user_form.cleaned_data['password']) # Save the User object new_user.save() return HttpResponse('IZI') else: print(user_form.errors) user_form = UserRegistrationForm() # errors = user_form.errors data = {'user_form': user_form, 'errors': user_form.errors} return render(request, 'registration.html', data) # return HttpResponse(simplejson.dumps(errors)) else: user_form = UserRegistrationForm() return render(request, 'registration.html', {'user_form': user_form}) models.py class TestUser(AbstractUser): phone = PhoneNumberField(null=False, blank=False, unique=True) class Meta: db_table = '"fyzzys"."users"' forms.py class UserRegistrationForm(forms.ModelForm): password = forms.CharField(label='Password', widget=forms.PasswordInput) password2 = forms.CharField(label='Repeat password', widget=forms.PasswordInput) phone = PhoneNumberField(region='RU', required='true') email = forms.CharField(error_messages='') class Meta: model = TestUser fields = ('username', 'first_name', 'email', 'phone') def clean_password2(self): cd = self.cleaned_data if cd['password'] != cd['password2']: raise forms.ValidationError('Passwords don\'t match.') return cd['password2'] -
Serialize data is not giving output as expected
I have 3 django models like this To keep record of orders class Orders(models.Model): restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE, blank=True, null=True) total_amount = models.DecimalField(max_digits=10, decimal_places=2) which articles are in order like pizza etc class OrderArticle(models.Model): order = models.ForeignKey(Orders, on_delete=models.CASCADE) article = models.ForeignKey(Articles, on_delete=models.CASCADE) Article options of articles in order (like topping on pizza , now topping can be 4 or more types) class OrderArticleOptions(models.Model): article_option = models.ForeignKey(ArticlesOptions, on_delete=models.CASCADE) order_article = models.ForeignKey(OrderArticle, on_delete=models.CASCADE) quantity = models.IntegerField(default=1) price = models.DecimalField(max_digits=10, decimal_places=2) To keep track of this multipul type of Article options I made this table . So example will be . Customer purchased a pizza with 2 toppings , 1st topping quantiity is 1 and 2nd topping quantity is 3 . to get this use case using Django Rest framework I am doing this My serilizer class OrderArticleOptionSerilizer(serializers.ModelSerializer): order_article = OrderArticleSerilizer(required=False, read_only=True) article_option=ListCategoriesSerializer(required=False, read_only=True) class Meta: model = OrderArticleOptions fields = '__all__' and my view to show it is @permission_classes([AllowAny]) class OrderedArticles(APIView): def get(self, request, restid): orders = OrderArticleOptions.objects.all() orderserlizer = OrderArticleOptionSerilizer(orders, many=True) return Response(success_response({'orders': orderserlizer.data}, "Restaurant with this all data."), status=status.HTTP_200_OK) Issue Now issue is when I add 2 type of toppings to a single article in order it creates 2 orders … -
django listing all debts of customers
I'm using the django-rest framework. I have a list called customers. (customers) and I have a table where I add the debts of the customer. I want to make a separate inquiry screen and list the debts of all customers. api / debtlist form a customer can have more than one debt record. therefore, I want to show the total debt, total received and remaining debt amounts of each customer in a single line. How can I do this? -
I want to add target="_blank" to Django's template html
I want to add target="_blank" to Django's template html,but I cannot understand how to do it. My html is like {% block meta_title %}AAA{% endblock %} and when I click this AAA button,my ideal is to be able to open new tab of AAA page. But I cannot understand how I should add target="_blank". -
Access the model through a foreign key
I have an Author object, and a Product object with a foreign key on the Author. How can I get all the products of the current author? -
How to use paginator in Django?
I have a for loop and am trying to get a paginator to work. What code do I need with the buttons at the bottom of the html to get the pages to be split? {% for post in page.get_children|slice:":4" %} ... {% endfor %} <button class="">Previous</button> <button class="">Next »</button> I have tried this code below but the text isnt appearing? {% if page.get_children.has_next %} <a href="?page={{ page.get_children.next_page_number }}">next</a> <a href="?page={{ page.get_children.paginator.num_pages }}">last &raquo;</a> {% endif %} -
update model after another model updated django
i have 3 model CustomUser, Artist and UserProfile what i am trying to acheive here when user register its automatically created userprofile and artist and when i update userprofile its update the artist model custom user model class CustomUser(AbstractBaseUser, PermissionsMixin): artist_choice = [ (0, 'celebrities'), (1, 'singer'), (2, 'comedian'), (3, 'dancer'), (4, 'model'), (5, 'Photographer') ] artist_category = models.IntegerField(choices=artist_choice, null=True) email = models.EmailField(max_length=100, unique=True) name = models.CharField(max_length=100) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_superuser = models.BooleanField(default=False) last_login=models.DateTimeField(null=True, blank=True) date_joined = models.DateTimeField(auto_now_add=True) #country = CountryField() USERNAME_FIELD = 'email' EMAIL_FIELD='email' REQUIRED_FIELDS=[] objects=UserManager() def get_absolute_url(self): return "/users/%i/" % (self.pk) artist model class Artist(models.Model): CHOICES = ( (0, 'celebrities'), (1, 'singer'), (2, 'comedian'), (3, 'dancer'), (4, 'model'), (5, 'Photographer') ) name = models.CharField(max_length=100) artist_category = models.IntegerField(choices = CHOICES, null=True) artist_image = models.ImageField(upload_to= 'media',null=True) bio = models.TextField(max_length = 500) def __str__(self): return self.name custom user profile class UserProfile(models.Model): CHOICES = ( (0, 'celebrities'), (1, 'singer'), (2, 'comedian'), (3, 'dancer'), (4, 'model'), (5, 'Photographer') ) user = models.OneToOneField(CustomUser, related_name='userprofile', on_delete= models.CASCADE) # email = models.EmailField(max_length=100, unique=True) image = models.FileField(upload_to=None, max_length=100) artist_category = models.IntegerField(choices= CHOICES, null=True) mobile_number = PhoneNumberField(null=True) country = CountryField(default = 'IN') city = models.CharField(blank=True, max_length=100) bio = models.TextField(blank=True) def __str__(self): return self.user.name creating userprofile … -
Django TestCase APIClient post request with vs Request package
When I use python's request package to post some data (to Amazon S3) which contains a dict consist of a file and some other string data, request package automatically sets the content-type to multipart/form-data. response=requests.post(data['url'],files=fields) This posts the file and it works great. But Because I am in Django I want to use APIClient or Client to do the same thing. First I tried this: awsclient= APIClient() content_type = 'multipart/form-data' response=awsclient.post(data['url'],data=fields,format=content_type) I get this error Invalid format 'multipart/form-data'. Available formats are 'multipart'. Set TEST_REQUEST_RENDERER_CLASSES to enable extra request formats. I could not find a lot of info on this. So I tried this awsclient= APIClient() content = encode_multipart('TestCaseBoundry', fields) content_type = 'multipart/form-data; boundary=TestCaseBoundry' response=awsclient.post(data['url'],content,content_type=content_type) which also does not work. I get a 404 error from the server. What are some of the ways to debug this Is it suppose to be field= or content_type= for 'multipart/form-data' How would you track down why this is happening ? WireShark? Is there a way to print the request headers of Client or ApiClient? I have written a javascript code which does the same post with XMLHttpRequest using FormData and that also uses multipart/form-data and it works great. Long story short I can just … -
storing and accessing users properly in django session
Here I am trying to store selected users in some django session and for this I have tried like this but while retrieving the users from session in another view I am getting empty queryset.How can i get the users which are stored in session in another django fucntion? storing selected users in session selected_users = get_user_model().objects.filter(id__in=request.POST.getlist('users')) initial = {'users':[]} session = request.session.get('users',initial) if selected_users: for user in selected_users: if not user in session['users']: session['users'].append(user.email) print(session['users']) here trying to retrieve these session's users in another view sess = request.session.get('users',{'users':[]}) users = get_user_model().objects.filter(pk__in=sess["users"]) print('sess',users) #didn't worked request.session['users'] # didn't worked either -
Django migrate after inspectdb - Problem with existing foreign key fields
For a mysql database (schema previously maintained from sqlalchemy orm), I have generated django models with the inspectdb management command. The models work fine, e.g. with relations usable from the admin views. That means I can choose related models for the foreign key form fields. The initial migration made with makemigrations look ok , but the foreign key fields are missing. The models at that point still have the meta class setting managed=False . After changing managed to True , the migrations want to create the foreign key fields. Even if the db_column is explicitly set (and, of course, that fields exists). That might look something like this. class SomeThing(models.Model): name = models.CharField(max_length=128, blank=True, null=True) mandant = models.ForeignKey( 'Owner', models.CASCADE, db_column='owner_id' ) When applying the migration, it errs because the field already exists. What is the best way to deal with this situation ? Why does django not get the foreign key fields in the first inspectdb step ? Is there a way to hint to the migration system that the field already exits? -
Django >> contrib/auth/models.py >> Templates ? Ar these the only templates >> django/forms/templates/django/forms/widgets
I have been searching for a while - my usecase is simple and common. Have to use "django_registration-redux" to give users a Register link . Format the HTML template enough , to make it presentable . The register form is being provided by - class AbstractUser within the file = django/contrib/auth/models.py . The templates being used are from DIR django/forms/templates/django/forms/widgets . Adding anything in here - say i add some HTML to the file input.html , does not give the desired results . Also adding formatted html within the file django/contrib/auth/models.py , in the class AbstractUser(AbstractBaseUser, PermissionsMixin): , also doesnt give desired results. I tried adding - help_text = format_html('<div style="color:grey;"> {} <strong><b>{}</b></strong> {}</div>', 'Username is a Required Field. Your UserName for' , 'DigitalCognition', 'can have max - 150 characters. You may use Letters, digits and @/./+/-/_ only.'). Finally my Question - Where to find the base.html or any kind of scaffolding templates for these widgets , i understand tinkering with these widgets is incorrect , thanks -
How can I display an image on a web page in django that is on my desktop?
I am loading data from postgresSQL database. This data is stored in the database by my python program. Not I am fetching data with the same functions I am using in my program. I want to create a bar chart before displaying it on my HTML webpage in Django. I created a chart using matplotlib and saved it on the desktop. Now I want to fetch that image and display it. I tried giving a link directly to that image but that doesn't load the picture. -
Django UnitTest KeyError Testing a "Standad" CreateForm
This is my Modell of which I want to UnitTest the CreateForm: And these are my UnitTests: This is the CreateForm: And Finally, the Console Output when I try to run the Test with: py -3 manage.py makemigrations -v3 py -3 manage.py migrate -v3 isort -rc . pmanage.py collectstatic --noinput -v3 py -3 manage.py test -v3 coverage3 run --source=catalog --omit=*migrations* manage.py test -v3 coverage3 report -m py -3 manage.py runserver -v3 This is the Console Output: Here are all the Images in Plain searchable copyable Text: models.py #!/usr/bin/python3 # -*- coding: utf-8 -*- import uuid from django.db import models from django.urls import reverse # Create your models here. class context(models.Model): """Model representing a context. (for example telba.de)""" CONTEXT = models.CharField(verbose_name='Kontext', primary_key=True, unique=True, max_length=200, help_text='') COUNTRYPREFIX = models.IntegerField(verbose_name='Ländervorwahl', help_text='') CITYPREFIX = models.IntegerField(verbose_name='Ortsvorwahl', help_text='') ROOTNUMBER = models.IntegerField(verbose_name='Nummer', help_text='') EXTENSIONSFROM = models.IntegerField(verbose_name='Nebenstellen von', help_text='') EXTENSIONSTILL = models.IntegerField(verbose_name='Nebenstellen bis', help_text='') PORTSCOUNT = models.IntegerField(verbose_name='Anzahl erlaubter Nebenstelen', help_text='') CALLPERMISSIONS_CHOICES = ( (u'0', u'WorldWide'), (u'1', u'Europe'), (u'2', u'National'), (u'3', u'None'), ) CALLPERMISSIONS = models.CharField(verbose_name='Anrufberechtigungen', max_length=1, choices=CALLPERMISSIONS_CHOICES, help_text='') def __str__(self): """String for representing the Model object context.""" return self.CONTEXT def get_absolute_url(self): """Model representing a context.""" return reverse('context-detail', args=[str(self.CONTEXT)]) forms.py class contextCreateForm(ModelForm): # def __init__(self, context, *args, **kwargs): def … -
Multi FormSet error "Calling modelformset_factory without defining 'fields' or 'exclude' explicitly is prohibited"
modelformset_factory error "Calling modelformset_factory without defining 'fields' or 'exclude' explicitly is prohibited." I want to create an dynamic form with multiple input fields add or remove using jQuery. But I got error when I try to run my code. I mentioned my code down please check and help me to solve this problem. Thanks I follow a tutorial and Github code. Here is link Youtube: https://www.youtube.com/watch?v=Tg6Ft_ZV19M Github code: https://github.com/shitalluitel/formset views.py def acc_journal(request): journalEntryFormset = modelformset_factory( AccountsJournalVoucherEntery, form=AccountsPymtVoucherForm) form = AccountJournalVoucherForm(request.POST or None) journalEntryset = journalEntryFormset( request.POST or None, queryset=AccountsJournalVoucherEntery.objects.none(), prefix='journalentries') if request.method == 'POST': if form.is_valid() and journalEntryset.is_valid(): try: with transaction.atomic(): journalvc = form.save(commit=False) journalvc.save() for journalEntry in journalEntryset: entery = journalEntry.save(commit=False) entery.journalvc = journalvc entery.save() except IntegrityError: print('Error Encountered') return redirect('accunts-journal') context = { 'acc_journal_acti': 'active', 'main_header': 'Accounts', 'header_heading': 'Journal', 'acc_journals': Accounts_journal_voucher.objects.all(), 'form': form, 'formset': journalEntryset } return render(request, 'accounts/journal.html', context) model.py class Accounts_journal_voucher(models.Model): journal_voucher_id = models.AutoField(primary_key=True) acc_jurnl_vc_num = models.CharField(max_length=50, blank=False) acc_jurnl_vc_loc = models.CharField(max_length=50, blank=False) acc_jurnl_vc_date = models.DateField(auto_now=False) acc_jurnl_vc_ref_num = models.CharField(max_length=50, blank=True) acc_jurnl_vc_total_debit = models.DecimalField( max_digits=30, decimal_places=2, blank=True, null=True) acc_jurnl_vc_total_credit = models.DecimalField( max_digits=30, decimal_places=2, blank=True, null=True) acc_jurnl_vc_info = models.TextField(blank=True) acc_jurnl_vc_added_by = models.CharField(max_length=200, blank=True) acc_jurnl_vc_date_added = models.DateTimeField( default=datetime.now, blank=True) def __str__(self): return self.acc_jurnl_vc_num class AccountsJournalVoucherEntery(models.Model): ajve_id = models.AutoField(primary_key=True) ajve_journal_vc = … -
How to format Django form with UIKit styling
I am struggling to see a way to style a django form in the style of a uikit horizontal form. UIKit has the styling I want and Django has the validation and templating I want.A way to implement a datepicker too would be useful. I have tried the plain django form template with .as_p and .as_table. I have also tried to use Meta and widgets but couldn't get that to work. I can't see how I can add the needed uikit tags to each element and add the uk-form-controls div. template.html <form class="uk-form-horizontal uk-margin-large uk-align-center"> <div class="uk-margin"> <label class="uk-form-label" for="form-horizontal-text">Job Title</label> <div class="uk-form-controls"> <input class="uk-input uk-form-width-large" id="form-horizontal-text" type="text" placeholder="Some text..."> </div> </div> forms.py class job_form(forms.Form): job_title = forms.CharField(label='Job Title', max_length=50) hiring_manager = forms.CharField(label='Hiring Manager', max_length=50) job_description = forms.CharField(label='Job Description', max_length=50) salary = forms.IntegerField() closing_date = forms.DateField() I am expecting to be able to have the uikit form styling with the templating and validation of django forms but am yet to get it to work. -
How to know which version of apps been used in django [duplicate]
This question already has an answer here: How can I get a list of locally installed Python modules? 27 answers I have been using django for my web project. I forgot to add requirements.txt file. Now I have already installed so many apps even third party apps. How do I know which version of apps I have been installed and their names? Comand line This is the comand line I used to know which apps been using in the django project but the thing is I can only get the few app names with this comand not the version. python manage.py makemigrations -
How can I get the worker address for Celery's app.control.broadcast
I wish to broadcast a panel command to a specific worker using app.control.broadcast, using the destination parameter. What exactly does the destination list expect as an address to a worker? And how can I get that address from the worker (which I know is an unusual request but is easiest for my workflow here.)