Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
List One to Many Relationship
I'm sure this is a very basic question but I have a OneToMany Relationship and I wish to list all the associated children on a page. Here's what i have so far. Model File from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Post(models.Model): title = models.CharField(max_length=100) date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title def get_absolute_url(self): return reverse ('blog-post' , kwargs = {'pk': self.pk}) class Paragraph(models.Model): content = models.TextField(default='') post = models.ForeignKey(Post,default='', on_delete=models.CASCADE) def __str__(self): return self.content class Subtitle(models.Model): subtitle = models.CharField(max_length=100,default='') post = models.ForeignKey(Post,default='', on_delete=models.CASCADE) def __str__(self): return self.subtitle View model = Post template_name = 'blog/post.html' context_object_name = 'post' HTML FILE {%block content%} {% if post.author == user %} <a href="{%url 'blog-update' post.id %}">Edit</a> <a href="{%url 'blog-delete' post.id %}">Delete</a> {% endif %} <div class = 'content'> <h2>{{post.title}}</h2> <!-- I want to show Subtitle here--><p></p> <!-- I want to show Paragraph here--><p></p> <h3>By: {{post.author}} on {{post.date_posted}}</h3> </div> {% endblock content %} -
Nginx 502 Bad Gateway with uwsgi+Django app
I am trying to set up nginx to serve my django application with uwsgi, but I am running into an error: whenever I connect to port 80, I get the nginx start page. But when I try to connect on port 8000, I get a 502 bad gateway. I am following a guide, and I am stuck at this step: https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html#if-that-doesn-t-work. I've also tried following a few other guides, but I wasn't able to get it working with any of them, so maybe there's an issue with my configuration. I tried running uwsgi with the following command: uwsgi --socket mysite.sock --wsgi-file test.py --chmod-socket=666 as the guide suggests, but I am still getting a permission denied error: 2020/02/23 20:26:43 [crit] 3745#3745: *25 connect() to unix:///home/bitnami/nate_site/nate_site.sock failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: xxx.xxx.xxx.xxx, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/bitnami/nate_site/nate_site.sock:", host: "xxx.xxx.xxx.xxx:8000" 2020/02/23 20:26:44 [crit] 3745#3745: *25 connect() to unix:///home/bitnami/nate_site/nate_site.sock failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: xxx.xxx.xxx.xxx, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/bitnami/nate_site/nate_site.sock:", host: "xxx.xxx.xxx.xxx:8000" systemctl status nginx shows the service running just fine, so I'm not sure why this error is appearing. I am stopping and starting these processes (nginx, django, etc.) … -
How you implement yowsup with django?
Is there anyone who integrate yowsup with Django? -
Error trying running splinter with django web browser client
I am trying to use splinter with django web browser client to have a fully python testing chain (with the possibility of java script testing). But I have this error : AttributeError: module 'django.conf.global_settings' has no attribute 'ROOT_URLCONF' I saw I can set ROOT_URLCONF into setting.configure where I already added the default charset. But I have no idea of which module I need to set in ROOT_URLCONF. Can you please give me help, or give me the smallest code to run splinter with the django web browser client. Here is my code : from splinter import Browser from django.conf import settings settings.configure(DEFAULT_CHARSE='utf-8') from splinter import Browser browser = Browser('django') url = "http://www.google.com" browser.visit(url) Thanks a lot ! -
Django-mysqlclient version error in production app uploaded on google app engine?
I have encountered this error about mysql version- django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3. (Error copied from error logs in gcloud)I also encountered this same error locally so I applied this solution where I changed the base.py and operations.py files locally on my PC and it worked- Django - installing mysqlclient error: mysqlclient 1.3.13 or newer is required; you have 0.9.3 But now I am facing the same issue after deploying the webapp on Google Cloud. Any suggestions on how I can edit the same set of files specified in the other solution on gcloud? Or any other solutions? -
checking radio button on Django view from template
I am creating a custom sign up form and this is the view I created: def signup(request): if request.user.is_authenticated: return render(request, 'listings/index.html', {}) if request.method == 'POST': if 'cr-1' in request.POST: newuser = User.objects.create_user(username=request.POST.get('email'), email=request.POST.get('email'), password=request.POST.get('password')) newpatient = Patient.objects.create(user=newuser) user = authenticate(request, username=username, password=password) if user is not None: auth_login(request, user) return redirect('dashboard') elif 'cr-2' in request.POST: newuser = User.objects.create_user(username=request.POST.get('email'), email=request.POST.get('email'), password=request.POST.get('password')) newdoctor = Doctor.objects.create(user=newuser) user = authenticate(request, username=username, password=password) if user is not None: auth_login(request, user) return redirect('dashboard') else: print("##################### NOTHING HAPPENED #####################") return render(request, 'dashboard/signup.html', {}) I purposely added an else statement printing NOTHING HAPPENED on the console because nothing happens when I click on submit. Here is the template: <form class="form-type-material" method="POST" action="{% url 'signup' %}"> {% csrf_token %} <div class="custom-control custom-radio"> <input type="radio" id="cr-1" name="rg-1" class="custom-control-input" checked> <label class="custom-control-label" for="cr-1">Patient/Visiteur</label> </div> <div class="custom-control custom-radio"> <input type="radio" id="cr-2" name="rg-1" class="custom-control-input"> <label class="custom-control-label" for="cr-2">Médecin/Praticien</label> </div> <div class="form-group"> <input type="text" class="form-control" id="id_email" name="email" required> <label for="email">Adresse email</label> </div> <div class="form-group"> <input type="password" class="form-control" id="id_password" name="password" required> <label for="password">Mot de passe</label> </div> <div class="form-group"> <input type="password" class="form-control" id="id_password-conf" name="password-conf" required> <label for="password-conf">Confirmation du mot de passe</label> </div> <div class="form-group"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" required> <label class="custom-control-label">I agree to … -
Don't update dependencies while updating django app to heroku
I have deployed my django app to heroku. Now I will have to make some minor changes to the app. My understanding is that there's no way to update only one file on heroku, you have to push the whole app again. This is very time consuming. In particular the longest part is when heroku starts to reinstall all the dependencies from requirements.txt. So my question is, how do I stop heroku from reinstalling the dependencies? I heard of .gitignore. What do I need to specify there? -
TypeError at /create/
I want to create a system. For this system I need to a patient create form. When I click the button, I can save the patient but there is a error page after I pushed it. TypeError at /create/ get_absolute_url() missing 1 required positional argument: 'self' Where is my mistakes? Thanks a lot. views.py def patient_create(request): if not request.user.is_authenticated: return render(request, "http404.html") form = PatientForm(request.POST or None, request.FILES or None) if form.is_valid(): post = form.save(commit=False) post.user = request.user post.save() messages.Info(request, "Success!!") return HttpResponseRedirect(newPatients.get_absolute_url()) context = { 'form': form } return render(request, "patient_form.html", context) models.py class newPatients(models.Model): title = models.CharField(max_length=100) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) created_date = models.DateTimeField(default=timezone.now) dept = models.TextField() address = models.TextField() phone = models.CharField(max_length=15) notes = RichTextField(verbose_name="notes") slug = models.SlugField(max_length=100,unique=True, editable=False) def publish(self): self.published_date = timezone.now() self.save() def __str__(self): return self.title def get_create_url(self): return reverse('post:create', kwargs={'slug': self.slug}) def get_unique_slug(self): slug = slugify(self.title.replace('ı', 'i')) unique_slug = slug counter = 1 while newPatients.objects.filter(slug=unique_slug).exists(): unique_slug = '{}-{}'.format(slug, counter) counter += 1 return unique_slug def get_absolute_url(self): return reverse('post:create', kwargs={'slug': self.slug}) def save(self, *args, **kwargs): self.slug = self.get_unique_slug() return super(newPatients, self).save(*args, **kwargs) class Meta: ordering = ['-created_date'] traceback Environment: Request Method: POST Request URL: http://127.0.0.1:8000/create/ Django Version: 2.2.9 Python Version: 3.7.0 Installed … -
Get last instance object per each month and sum per month in Django
I tryed to search for answer but nothing yet can help me. I have one class model Activity and a class model Status : class Status(models.Model): activity = models.ForeignKey(Activity, on_delete=models.CASCADE, related_name="all_status") status_date = models.DateField() actual_progress = models.DecimalField(max_digits=3, decimal_places=2) I need to get last 'status_date' for each activity for each month and sum up its actual_progress. Can't find after many research a way out. -
i have problem related to background image in css django
my background image is not shown in website the image in static folder under /projectname/static/img and css under /projectname/static/css/style.css . in css image url on #showcase { background: url("../img/showcase.jpg") no-repeat top center fixed/cover; -- other lines under it-- etc.} NOW in template under /projectname/template/pagesapp/index.html here id of section id= showcase where i want to apply image. but not shown after spend 6 days on it big problem i try this on simple project its workings but not on this. i check every thing collect static and collect static under projectanme/rentalrooms/static,settings.py where. and static root on base (projectname/static)help me plzz` #showcase { background: url("../img/showcase.jpg") no-repeat top center fixed/cover; position: relative; min-height: 650px; color: #fff; padding-top: 6rem; } #showcase .home-search { min-height: 400px; position: relative; border-radius: 5px; } #showcase .overlay { content: ''; position: absolute; top: 0; left: 0; min-height: 400px; width: 100%; background: rgba(51, 51, 51, 0.8); } {% extends 'base.html' %} {% block title %} | Welcome {% endblock%} {% load humanize %} {% block content %} <!-- Showcase --> <section id="showcase"> <div class="container text-center"> <div class="home-search p-5"> <div class="overlay p-5"> <h1 class="display-4 mb-4"> Rooms Searching Just Got So Easy </h1> <p class="lead">Stop Finding Rooms Manually Its Our Duty To … -
Dockerized Django Nginx and Postgres Issue with Nginx.conf: refused to connect
Setting up a docker-compose Django app with Nginx and Postgres is seperate dockers on a digitalocean droplet. I'm having an issue pushing to production, there is a lack of communication between gunicorn and nginx, I believe. url is printrender.com ' Here is the log from docker on my digitalocean droplet: # docker-compose -f docker-compose.yml up /usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown. warnings.warn(warning, RequestsDependencyWarning) Starting mysite_postgres_1 Recreating mysite_django_1 Recreating mysite_nginx_1 Attaching to mysite_postgres_1, mysite_django_1, mysite_nginx_1 postgres_1 | LOG: database system was shut down at 2020-02-23 19:13:29 UTC postgres_1 | LOG: MultiXact member wraparound protections are now enabled postgres_1 | LOG: database system is ready to accept connections postgres_1 | LOG: autovacuum launcher started django_1 | mkdir: cannot create directory ‘./logs/’: File exists django_1 | ==> ./logs/gunicorn-access.log <== django_1 | django_1 | ==> ./logs/gunicorn.log <== django_1 | [2020-02-23 19:14:07 +0000] [1] [INFO] Starting gunicorn 19.9.0 django_1 | [2020-02-23 19:14:07 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1) django_1 | [2020-02-23 19:14:07 +0000] [1] [INFO] Using worker: sync django_1 | [2020-02-23 19:14:07 +0000] [12] [INFO] Booting worker with pid: 12 django_1 | [2020-02-23 19:14:07 +0000] [13] [INFO] Booting worker with pid: 13 django_1 | [2020-02-23 19:14:07 +0000] [14] … -
i've never seen this error before in django-admin
hi everyone my problem is : when i try to go to my admin panel this error shows up , ps: i made a registration system for costum user AttributeError at /admin/login/ 'ellipsis' object has no attribute 'rsplit' what does this mean ? views.py: from django.shortcuts import render from django.urls import reverse from django.contrib.auth.decorators import login_required from django.http import HttpResponse,HttpResponseRedirect from django.contrib.auth import authenticate,login,logout from django.views.generic import FormView,TemplateView,ListView from django.conf import settings from .forms import RegisterForm from .models import User # Create your views here. #user-login view def register(request): registred=False if request.method=="POST": user_register=RegisterForm(data=request.POST) if user_register.is_valid(): username=user_register.cleaned_data.get('username') email=user_register.cleaned_data.get('email') password=request.POST.get('password') user=User.objects.create(username=username,email=email,password=password) user.set_password(user.password) user.save() registred=True return HttpResponseRedirect(reverse('')) else: return HttpResponse('there is a problem') else: return render(request,'register.html',{'registred':registred,'user_register':RegisterForm}) def user_login(request): if request.method=='POST': email=request.POST.get('email') password=request.POST.get('password') user=authenticate(email=email,password=password) if user is not None: return HttpResponseRedirect(reverse('index')) else: return HttpResponse("Account not found") else: return render(request,'login.html') #user-logout view @login_required def user_logout(request): logout(request) return HttpResponseRedirect(reverse('index')) thanks in advance for helping me guys azertyyuiioozzrarzereztoperiypoteiporiyeryertyr -
Write a script file (.bat or .cmd) for Windows, so I can autorun an existing Django Project on any Windows 10 PC with Python preinstalled
I already finished a Django project (development mode) and I just want to run it from any Windows PC with Python pre-installed. My project folder already includes a venv folder that was created when I create a virtual enviroment in PyCharm. I create a simple .cmd file and include this commands. venv\Scripts\activate python manage.py runserver I put this file inside the project file on the same level with manage.py file and venv folder. I don't know why but problem is that command prompt open and close without any error. I tried to run as administrator but nothing changes. When I manually open the command prompt, change the directory to the project file and run the above commands (enable virtual enviroment and runserver) everything works perfectly fine. In addition when I add this line on the top cd D:\PycharmProjects\MyProject which is the directory of my Project, nothing happens. I don't want any solution that includes installing anything more than Python (Git for Windows or such), I prefer to write a script file to successfully run python manage.py runserver with success with something that is already preistalled by default with Windows (Command Prompt or PowerShell) Thanks. -
How I display category list on my django blog sidebar?
I'm working on a Django blog I try to use django-categories pip and after setting it up successfully I'm able to categorize my post in different categories but the I'm not getting over is how I display all available categories of my blog in a list. I tried using {{ category.name }} but nothing is displayed in blog sidebar. -
Django FieldError at /create/
I want to create a patient form for my system. I entry all values but it cannot save the patient and shows an error. Where is my mistake? FieldError at /create/ Cannot resolve keyword 'slug' into field. Choices are: address, created_date, dept, first_name, id, last_name, notes, phone, title Thanks for your attention. Traceback: File "C:\Users\edeni\senior\myenv\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\core\handlers\base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\core\handlers\base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\edeni\senior\pharsys\patients\views.py" in patient_create 29. post.save() File "C:\Users\edeni\senior\pharsys\patients\models.py" in save 39. self.slug = self.get_unique_slug() File "C:\Users\edeni\senior\pharsys\patients\models.py" in get_unique_slug 33. while newPatients.objects.filter(slug=unique_slug).exists(): File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\query.py" in filter 892. return self._filter_or_exclude(False, *args, **kwargs) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\query.py" in _filter_or_exclude 910. clone.query.add_q(Q(*args, **kwargs)) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\sql\query.py" in add_q 1290. clause, _ = self._add_q(q_object, self.used_aliases) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\sql\query.py" in _add_q 1318. split_subq=split_subq, simple_col=simple_col, File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\sql\query.py" in build_filter 1190. lookups, parts, reffed_expression = self.solve_lookup_type(arg) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\sql\query.py" in solve_lookup_type 1049. _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) File "C:\Users\edeni\senior\myenv\lib\site-packages\django\db\models\sql\query.py" in names_to_path 1420. "Choices are: %s" % (name, ", ".join(available))) Exception Type: FieldError at /create/ Exception Value: Cannot resolve keyword 'slug' into field. Choices are: address, created_date, dept, first_name, id, last_name, notes, phone, … -
How to solve "django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty" when using a service method in a venv?
I'm using Django 2.0 and Python 3.7. I have this settings file, articleagg_project/settings/base.py, with this defined ... # This is the default header sent to the scraping requests HDR = {'User-Agent' : 'super happy flair bot' } When I try and run a service method I have defined in my virtual environment, it seems to have trouble accessing the above setting ... localhost:articleagg_project davea$ source venv/bin/activate (venv) localhost:articleagg_project davea$ python ... >>> from articleagg.services.media_service import MediaService >>> code = MediaService.doImageSearch(image_url) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/davea/Documents/workspace/articleagg_project/articleagg/services/media_service.py", line 79, in doImageSearch headers = settings.HDR File "/Users/davea/Documents/workspace/articleagg_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 57, in __getattr__ self._setup(name) File "/Users/davea/Documents/workspace/articleagg_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/Users/davea/Documents/workspace/articleagg_project/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 126, in __init__ raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. The offneding line 79 where this is dying looks like this headers = settings.HDR I import my settings earlier in my service file like so ... from django.conf import settings So what else do I need to do to get this to run in my virtual environment? -
Is there a way to make @import work in CSS files within Django?
The CSS stylesheets in my Django website are served as static files (so their URLs are constructed using the {% static %} template tag), but I find myself in need of importing a CSS file inside another CSS file, where Django template tags will not work. Is there a way to dynamically populate the argument to @import inside a CSS file? Or will I have to just <link> the two files separately inside the HTML page? -
select checkbox and display pats of form accordingly
have the code for two checkboxes but how can I do it for 3? -
How to use distinct() with Window() when annotating a queryset
I have been working on this for hours and can't seem to get it. How do I annotate the Count() of distinct() user values? This cumulatively sums ALL the objects: queryset = queryset.annotate( user_views_cumsum=Window(Count('user'), order_by=F('date_time').asc())).values( 'user', 'video', 'date_time', 'id', 'user_views_cumsum').order_by('date_time', 'user_views_cumsum') Adding distinct=True give me an error: queryset = queryset.annotate( user_views_cumsum=Window(Count('user', distinct=True), order_by=F('date_time').asc())).values( 'user', 'video', 'date_time', 'id', 'user_views_cumsum').order_by('date_time', 'user_views_cumsum') DISTINCT is not implemented for window functions So how do I use distinct so that it stops counting the all the users as one user? -
how to autofill input from slected option in model fade with django?
this is my code and i want get quantity value of selected option and with this code i can not get it can you help me please thank you ``` <div class="modal-body"> <form id="abc" method="POST" action="{#% url 'facture:lignefacture_register' %#}"> {% csrf_token %} <div class="form-group "> <label for="inputState">Produit</label> <select id="inputState" class="form-control" onchange="myFunction(event)"> <option selected> </option> {% for stoc in all_stocks %} <option>{{stoc.designation}}</option> {% endfor %} </select> <script> function myFunction(e) { document.getElementById("quantite").value ={{stoc.quantite_stock}} } </script> </div> <div class="form-group "> <label for="quantite">Quantité:</label> <input class="form-control" id="quantite" placeholder="Veuillez vous saisir la Quantité svp " maxlength="4" size="4"> </div> <div class="form-group "> <label for="quantite">Prix_HT:</label> <input type="quantite" class="form-control" id="quantite" aria- describedby="emailHelp" placeholder="Veuillez vous saisir la Quantité svp " maxlength="4" size="4"> </div> </form> </div> ``` thank you for your help again -
django checkbox select multiple models
Hi I have the following django model: class Issue(models.Model): title = models.CharField(max_length=200) date = models.DateTimeField(auto_now=True) assignee = models.ForeignKey(User, on_delete=models.CASCADE, related_name='assignee') owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='owner', null=True, blank=True) description = models.TextField() state = models.IntegerField(choices=STATUS_CHOICES, default=1) priority = models.IntegerField(choices=RELEVANCE_CHOICES, default=2) expired_date = models.DateField(auto_now=False, null=True, blank=True) and a form which allow a user to create an Issue instance: class IssueForm(forms.ModelForm): class Meta: model = Issue fields = ('title', 'description', 'assignee', 'state', 'priority', 'expired_date') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['title'].label = "Titolo" self.fields['description'].label = "Descrizione" self.fields['state'].label = "Stato" self.fields['priority'].label = "Priorità" self.fields['expired_date'].label = "Termine" self.fields['expired_date'].widget.attrs.update({'class': 'datepicker'}) self.fields['assignee'] = forms.MultipleChoiceField( choices=self.fields['assignee'].choices, widget=forms.CheckboxSelectMultiple, label=("Assegnatario") ) def clean(self): cleaned_data = super().clean() user_id = [i for i in cleaned_data['assignee']] cleaned_data['assignee'] = [User.objects.get(id=i) for i in user_id] return cleaned_data I render this form and the field assignee is a checkbox. I would like to be able to choose several assignee for the same issue, but I got an error because the Issue model expect just one User instance How can I modify my model Issue in order to get more than one user ? Thanks -
website.Product.category: (fields.E009) 'max_length' is too small to fit the longest value in 'choices' (3 characters)
I am new to Django and trying to run the cloned project from GitHub. Created a virtual environment by conda. Installed Django, Pillow by pip install django, python -m pip install Pillow in the activated virtual environment. but, when I run python manage.py runserver I am getting an error. Tried searching if there are any duplicate questions but seems like no one had the exact same issue. Here's the image of complete error with traceback -
how to get the data from text/html API response in Django
I send post request to (FortPay-Payment Gateway) API in Json format, and I get the Response in text/html format from the same URL ... what i need, is to get the data sent in this Response as it contains a Token that i need to reuse That is my request in the views.py: def DayTourCreditInput(request, buyer_id): buyer = get_object_or_404(DayBuyer, id=buyer_id) redirectUrl ='https://checkout.payfort.com/FortAPI/paymentPage' requestParams = { 'service_command ' : 'TOKENIZATION', '********' : '********************' #etc. } r = requests.post(redirectUrl, params=requestParams) content = r.text return HttpResponse(content, content_type='text/plain') ##I Tried r.json and r.json() and also return HttpResponse(contentJson, content_type='application/json') ... But all raises errors I looked for cgi python, but no enough docs available + i don't know if it is the suitable solution for this case or not Just wanna assure that the site respond by an html document with JavaScript involved in it -
Cookiecutter Django - Add field to signup form?
When I use django-allauth I can easily change the Signup form by just creating a new form and in settings.py add: ACCOUNT_SIGNUP_FORM_CLASS = "core.forms.SignupForm" I was unable to successfully do this with Cookiecutter Django. Shouldn't this work in Cookiecutter Django since it uses django-allauth? If not then how can I add or change fields for the signup form? -
django-celery-beat and DatabaseScheduler with a set first run time
I want to use django-celery-beat and DatabaseScheduler to create an "email alert" function for users. They should be able to say, when they want to receive these alerts (e.g. every day - 7 AM or every week monday 1 PM). I've almost figured out how to create the periodic tasks, i.e. >>> PeriodicTask.objects.create( ... interval=schedule, # we created this above. ... name='Importing contacts', # simply describes this periodic task. ... task='proj.tasks.import_contacts', # name of task. ... expires=datetime.utcnow() + timedelta(seconds=30) ... ) from https://github.com/celery/django-celery-beat, but how do I tell it when the first sendout should be?