Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Need help designing Django models (tracking changes over time)
I'd like to be able to track how much time a cluster of news articles can be seen inside and RSS feed, and how much time the news articles inside thoses clusters can be seen as well. To this end, I'm scrapping the RSS feed every 15min, I store the clusters inside a table, and I store the articles they contain inside another table. Here is a glimpse of the structure of the RSS feed ("item" would be a cluster of articles, and "news_item" an article): <channel> <title>Channel title</title> <description>Recent articls</description> <link>https:blabla</link> <atom:link href='' rel='self' type='application/rss+xml'/> <item> <title>Basic title</title> <ha:data1>50000</ha:data1> <description>basic description</description> <link>https://mylink</link> <pubDate>Mon, 29 Jul 2019 00:00:00 +0200</pubDate> <ha:data2>https:alink</ha:data2> <he:news_item> <he:news_item_title>SUB ITEM TITLE</he:news_item_title> <he:news_item_snippet>SUB ITEM SNIPPET</ht:news_item_snippet> </he:news_item> <he:news_item> <he:news_item_title>...</he:news_item_title> <he:news_item_snippet>...</he:news_item_snippet> </he:news_item> </item> As a cluster can have several articles, and knowing there is a chance that an article could be seen inside several clusters, I believe a many-to-many relationship is involved. This is how I designed my Django models for now: class Cluster(models.Model): title = models.TextField() data1 = models.CharField(max_length=100) search_link = models.URLField() first_seen = models.DateTimeField() last_seen = models.DateTimeField() #that is for keeping trace of the scrapping time class Meta: verbose_name = 'Cluster' verbose_name_plural = 'Clusters' def __str__(self): return self.title … -
Django contact form returning a gmstp error?
I may be getting this very wrong. I made a contact-us form where users can send us emails. basically, I will get the data from the form and send the emails in the view by send function. forms.py subjects = ( (1,'Bug/error reporting'), (2,'Enhancement suggestion'), (3,'Support and help'), (4,'General feedback') ) class ContactForm(forms.Form): name = forms.CharField(max_length=180) email = forms.EmailField(required=True) subject = forms.ChoiceField(choices=subjects,required=True) message = forms.CharField(widget=forms.Textarea(attrs={"rows":9, "cols":20})) views.py def emailView(request): # defining initial data for the forms user = request.user initial_data = { 'name' : user.first_name, 'email' : user.email, } if request.method == 'GET': form = ContactForm(initial=initial_data) return render(request, "email.html", {'form': form}) else: form = ContactForm(request.POST,initial=initial_data) if form.is_valid(): name = form.cleaned_data['name'] subject = form.cleaned_data['subject'] from_email = form.cleaned_data['email'] message = form.cleaned_data['message'] message_f = name + 'has the following message \n' + message email = EmailMessage(subject ,message_f ,from_email ,['myemail@email.com'], headers = {'Reply-To': from_email } ) email.send(fail_silently=False) return redirect('success') return render(request, "email.html", {'form': form}) and I get SMTPAuthenticationError but I don't want to use the email in my settings.py i want to use users emails to send it the emails to the myemail@email.com -
Django does not let me to manually type PK with postgresql
I have a model like this one. class MyModel(models.Model): id = models.IntegerField( primary_key=True, ) is_active = models.BooleanField( default=True, ) I want to put an id by myself. However django-postgresql does not allow me to do it. Here is my view: class MyView(APIView): def post(self, request, format=None): my_model = MyModel() my_model.id = 6 my_model.save() It throws exception on the .save() part. Here is the exception text: ProgrammingError at /myViews/myView relation "myDB_mymodel" does not exist LINE 1: SELECT (1) AS "a" FROM "myDB_mymodel" WHERE... -
Problem installing fixture: No JSON object could be decoded
I decided to deal with fixtures. ./manage.py dumpdata credits --indent 4 > fixtures/credit.json I made fixtures with help. Then deleted objects from the credit table. And now I try to create them again using fixtures. ./manage.py loaddata fixtures/credit.json But I get error: django.core.serializers.base.DeserializationError: Problem installing fixture '/home/m0nte-cr1st0/work_projects/startup/finbee/fixtures/credit.json': No JSON object could be decoded full traceback and json file https://dpaste.de/UcB7 -
HTML templates not updating using Django on Digital Ocean using WinSCP
I have a Django webapp, using Gunicorn and nginix on a digital ocean server. I have been updating HTML templates using WinSCP by just copying the updated HTML files from my local machine over to the digital ocean server (overwriting the old templates) and it has been working fine until now. For some reason one of my HTML templates is not updating on my website. I have even removed it completely and the page still loads fine? I have tried: sudo systemctl restart nginx sudo systemctl restart gunicorn Is there something else I'm missing here? I have double checked my urls.py and views.py 50 times trying to find the problem, but it seems to be something over my head... any help is appreciated! -
how do I get a django apps variable to the root app
I have a wait screen that will redirect you to the page specified when the page loads. I put the waitscreen in the main app so it could access the main root url conf to redirect the pages. But, the app that is calling the waitscreen can't pass the redirect variable to teh template because it is not in the same app. heres a hierarchy for better understanding mysite mysite templates mysite wait_screen.html --need to pass the redirect var up here urls.py views.py app1 views.py --this has the redirect variable in it here is my waitscreen in the mysite, it redirects in JS // Redirect var redirect_to = "/{{redirect_to}}"; -- the {{}} is the var used for redirecting window.location.replace(redirect_to); console.log(redirect_to) -- all I am getting right now is the '/' here is the views.py in app1 def wait_screen(request): redirect_to = request.GET.get("redirect_to", "") . --here is the variable context = {'redirect_to': redirect_to} --ps. are these even needed now vvv return render(request, 'mysite/mysite/wait_screen.html', context) -
In Django authentication for Corporate company via Active Directory, option available if LDAP is not installed
Developing application with Django for Corporate company and user need to authenticated based AD, what if LDAP has not installed then what could be available options to authenticate users -
For some reason django static files not working correctly
I am learning django right now and I am using templates for this. I have done everything as always (I think), but for some reason django static files not working perfectly. I tried to find a solution but nothing helped. This is the site now: How it should be: Inside "static" folder I have css, images, and so on. I have "{% load static %}" on the top of the html. I do not have any errors in the console. One of the static files: <link rel="stylesheet" href="{% static 'css/style.css' %}"> My settings.py: STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static") ] My folders: -
Unit gunicorn.socket could not be found
I get a 502 Bad Request error after deployment with nginx. I am using a digitalocean droplet. Everything works fine locally, so I must have missed something while bringing over the files to filezilla...? sudo tail -30 /var/log/nginx/error.log 2019/07/29 13:42:25 [crit] 1666#1666: *2 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 138.68.234.34, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "myi.pad.dress" 2019/07/29 13:42:30 [crit] 1666#1666: *4 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 46.114.6.201, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "myi.pad.dress" 2019/07/29 13:42:30 [crit] 1666#1666: *6 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 46.114.6.201, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/favicon.ico", host: "myi.pad.dress", referrer: "http://myi.pad.dress/" 2019/07/29 13:50:00 [error] 1666#1666: *8 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 46.114.6.201, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "myi.pad.dress" 2019/07/29 13:55:50 [crit] 1666#1666: *10 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 46.114.6.201, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "myi.pad.dress" 2019/07/29 13:57:18 [crit] 1666#1666: *12 connect() … -
Using AJAX/Django to Fill Customer Address
I have an 'Order' form where the user selects a Customer (from a foreignkey dropdown). There is a text field for Customer Address in the same form which I would like to auto-populate when the user selects Customer based on my Customer model which contains both customer name and customer address. My understanding is that this would require some AJAX, but I am completely inexperienced with AJAX and I'm hoping someone could show me an example of how to do this as I will have many similar cases through my program. MODELS.PY class Customers(models.Model): c_name = models.CharField(max_length=100) c_address = models.CharField(max_length=100) class Orders(models.Model): reference = models.IntegerField() c_name = models.ForeignKey(Customers) #dropdown the user selects from ship_to = models.CharField(max_length=1000) #this is the field I want to populate automatically ... FORMS.PY class CreateOrderForm(forms.ModelForm): class Meta: model = Orders fields = ('reference', 'c_name', 'ship_to', 'vessel', 'booking_no', 'POL', 'DOL', 'COO', 'POE', 'ETA', 'pickup_no', 'terms', 'sales_contact', 'trucking_co', 'loading_loc', 'inspector', 'total_cases', 'total_fob', 'freight_forwarder', 'commodity', 'is_airshipment', 'credit') VIEWS.PY def add_order(request): if request.method == "POST": form = CreateOrderForm(request.POST) if form.is_valid(): reference_id = form.cleaned_data.get('reference') form.save() return redirect('add_manifest', kwargs={'reference_id': reference_id}) else: form = CreateOrderForm() objectlist = Customers.objects.all() context = { 'form': form, 'objectlist': objectlist, } return render(request, 'add_order.html', context) when customer is … -
Django 1.11.2 error: django.db.utils.ProgrammingError: relation "eventtransactions" does not exist
I'm writing a Django Query to load data from a database. When I do it, I get an error that says: django.db.utils.ProgrammingError: relation "eventtransactions" does not exist LINE 1: ...sactions"."eventtransactions_id") AS "count" FROM "eventtran... I would like to create a loop that will count the number of event transactions for each membership type per day and store it in a dictionary where the key is the membertype and the value is the number of event transactions for that membertype on that day. I've tried modifying what is being counted but am having some trouble with it. I've tried counting by membertype and by custnum but am still getting the same ProgrammingError. fitness model: class EventTransactions(models.Model): eventtransactions = models.BigAutoField(primary_key=True) eventtransactions_id = models.IntegerField() profitcenter_id = models.IntegerField() customer_gender = models.TextField() customer_firstname = models.TextField() customer_lastname = models.TextField() actualdatetime = models.DateTimeField(blank=True, null=True) custnum = models.BigIntegerField(blank=True, null=True) birthdate = models.DateField(blank=True, null=True) membertype = models.TextField(blank=True, null=True) eventname = models.TextField(blank=True, null=True) class Meta: managed = False db_table = 'eventtransactions' import_swipe_counts.py import psycopg2 import redis import datetime import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError from urec.settings import REDIS_HOST, REDIS_DB from django.db.models import Count from django.db.models.functions import TruncDay from fitness.models import EventTransactions # the inverse mapping … -
Django LogoutView does not emit user_logged_out signal
I have an app that does not receive the user_logged_out signal that, in theory, should have been sent by LogoutView. urls.py: ... path('accounts/logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'), ... myapp/signals.py from django.contrib.auth import user_logged_out from django.dispatch import receiver @receiver(user_logged_out) def extra_logout(sender, request, user, **kwargs): # does some stuff myapp/apps.py from django.apps import AppConfig class MyappConfig(AppConfig): name = 'myapp' def ready(self): import myapp.signals return super().ready() Note that myapp is loaded, everything else works. The django session is destroyed when calling accounts/logout/, but my receiver never gets the signal. What am I doing wrong? Django 2.2.3, Python 3.7.3 on mac. -
How to send a response or notifications to a specific user in django
On my staff user, I'm trying to make a module for sending a response to a specific user, then that user will be notified about the response that I just sent. I already have a module for sending a response to a user that can choose a username for all active users. And I also have a module for notification for users. models.py class UserNotification(models.Model): sender=models.ForeignKey(User,on_delete=models.CASCADE,related_name='user_sender',default='') receiver=models.ForeignKey('custom_user.User',on_delete=models.CASCADE,related_name='user_receiver',default='') concern_type = models.CharField(max_length=100,choices=CHOICES) content = models.TextField(max_length=255,blank=False) date_sent = models.DateTimeField(default = timezone.now) forms.py class SendNotificationForm(forms.ModelForm): class Meta: model = UserNotification fields = ['receiver','concern_type','content'] views.py def user_notifications(request): notifications = UserNotification.objects.all().order_by('-date_sent') context = { 'notifications':notifications } template_name = [ 'notification.html', ] return render(request,template_name,context) When I try to send a response and choose a user's username to receive that notification. The notification is always broadcast to all users. I know that I still have more inadequate code in my app, but I just wanted to know what is your thoughts on my problem. -
How to check whether any elements of a list exist in an arrayfield in django?
I have list of table ids and I want to check if any of those ids occur in an array-field column. myList = [2,3] database column has values for example: [1], [1,4,3], [1,2,3,4], [2,3] I have a column in the db which is an arrayfield containing a list of ids from another table. I want to query this field and check if any elements in my list are in any rows of this column. I want to query this column and return those rows which have any occurrence of 2 or 3. -
Counting in django template
I want to count the numbers series in these templates for eg: in the 1st box, only one object is there S.no is 1, in the second box a lot of objects are there S.no starts from again 1,2,3,--- but I want to show serially], please help me, guys. -
Django authenticate() always return None for a custom model
I'm new to django, and I have to make a back-end with it. my issue: I have multiple models (clients,driver,company) all of them should login and authenticate (each one on a diffrent app, but they all extend the same user model), i have seen so many questions like this, but none of them solved my issue which is authenticate(username='username',password='password') always return none. the user record exists in the DB, i checked it with filter(username=(username). so here is some code: The UserManager class: class UserManager(BaseUserManager): def create_user(self, username, password, phone): if not username: raise ValueError("user must provide a username") if not password: raise ValueError("user must provide a password") if not phone: raise ValueError("user must povide a phone number") user_obj = self.model( user_name=username, phone=phone ) user_obj.set_password(password) user_obj.save() return user_obj the User class: class User(AbstractBaseUser): user_name = models.CharField(max_length=32, unique=True) email = models.EmailField(max_length=255, unique=True, null=True) phone = PhoneNumberField() access_token = models.CharField(max_length=255, unique=True, null=True) notifications_token = models.CharField(max_length=255, unique=True, null=True) photo = models.ImageField() person_in_contact = models.CharField(max_length=32) active = models.BooleanField(default=False) confirmedEmail = models.BooleanField(default=False) confirmedPhone = models.BooleanField(default=False) completedProfile = models.BooleanField(default=False) objects = UserManager() @property def is_active(self): return self.active def __str__(self): return "Client : " + self.user_name + " Email:" + self.email def get_email(self): return self.email USERNAME_FIELD = 'user_name' … -
Django range data with from and to date
I try create to queryset with dates - from=2019.01.01 to 2019.01.02 . And i want output all data who fell into this range with 2019.01.01 and 2019.01.02 inclusive My models: class Commitment(models.Model): scheduled_date = models.DateField() created_date = models.DateTimeField(auto_now_add=True, blank=True) Not work: commitments = Commitment.objects.filter(dealer=dealer, scheduled_date__year=get_next_year(), created__date__gte=self.from_date, created__date__lte=self.to_data) Not work: commitment_query = Q(dealer=dealer) commitment_query.add(Q(scheduled_date__year=get_next_year()), Q.AND) commitment_query.add(Q(created_date__gte=self.from_date), Q.AND) commitment_query.add(Q(created_date__lte=self.to_data), Q.AND) commitments1 = Commitment.objects.filter(commitment_query) Not work: commitments = Commitment.objects.filter(dealer=dealer, scheduled_date__year=get_next_year(), created_date__range=(self.from_date, self.to_data)) -
How to serialize a custom data set of two models in Django Rest Framework
I have a super important query: I want to serialize a set of data, or rather a model that has foreign keys of another model, so that through the foreign key I want to show the field of the other table, like the name: Model Equipos id_equipo=models.PositiveSmallIntegerField(primary_key=True) nombre=models.CharField(max_length=15) vendedor=models.CharField(max_length=10,default='S/A',blank=True) ip_gestion=models.GenericIPAddressField(protocol='Ipv4',default='0.0.0.0') tipo=models.CharField(max_length=8,default='S/A',blank=True) localidad=models.CharField(max_length=5,default='S/A',blank=True) categoria=models.CharField(max_length=10,default='S/A',blank=True) ultima_actualizacion=models.DateTimeField(auto_now=True) class Meta: db_table = 'Equipos' Model Interfaces class Interfaces(models.Model): id_interface=models.PositiveIntegerField(primary_key=True) id_EquipoOrigen=models.ForeignKey(Equipos,on_delete=models.DO_NOTHING,related_name='equipo_origen') id_PuertoOrigen=models.ForeignKey(Puertos,on_delete=models.DO_NOTHING,related_name='puerto_origen',null=True,blank=True) estatus=models.BooleanField(default=False) etiqueta_prtg=models.CharField(max_length=80,null=True,blank=True) grupo=models.PositiveSmallIntegerField(default=0,blank=True) if_index=models.PositiveIntegerField(default=0,blank=True) bw=models.PositiveSmallIntegerField(default=0,blank=True) bw_al=models.PositiveSmallIntegerField(default=0,blank=True) id_prtg=models.PositiveSmallIntegerField(default=0,blank=True) ospf=models.BooleanField(default=False) description=models.CharField(max_length=200,null=True,blank=True) id_EquipoDestino=models.ForeignKey(Equipos,on_delete=models.DO_NOTHING,related_name='equipo_destino') id_PuertoDestino=models.ForeignKey(Puertos,on_delete=models.DO_NOTHING,related_name='puerto_destino') ultima_actualizacion=models.DateTimeField(auto_now=True) So I want to create a serializer where, through the Id_EquipoOrigen (which refers to the Equipos model) of the interfaces model, it is able to be able to present in a json the fields nombre, localidad, categoria of the Equipos model. -
UpdateView and DeleteView lead to error 405 when submit is clicked
CreateView loads a form and when submit is clicked it redirects to the detail page of the new object; UpdateView correctly loads the form template already filled with the information about the current object but when submit is clicked to save the updates leads to a 405 blank page and the object is not updated; The same happens with DeleteView: 405 error and the object isn't deleted, the only difference is that DeleteView loads a different template form. It seems a common problem, I found different solutions on similar questions here but none is working for me. I'm stuck from a couple of days so any hint is really appreciated. Since I'm learning I would like to have some explanation about why this occours rather than some code I have to copy/paste. Thanks all. # urls.py app_name = 'articles' urlpatterns = [ path('', ArticleListView.as_view(), name='article-list'), path('create/', ArticleCreateView.as_view(), name='article-create'), path('<int:id>/update', ArticleUpdateView.as_view(), name='article-update'), path('<int:id>/', ArticleDetailView.as_view(), name='article-detail'), path('<int:id>/delete', ArticleDeleteView.as_view(), name='article-delete') #models.py class Article(models.Model): title = models.CharField(max_length=120) content = models.CharField(max_length=255) def get_absolute_url(self): return reverse("articles:article-detail", kwargs={"id": self.id}) # views.py class ArticleListView(ListView): template_name = 'templates/blog/article_list.html' queryset = Article.objects.all() class ArticleDetailView(DetailView): template_name = 'blog/article_detail.html' def get_object(self): id_ = self.kwargs.get("id") return get_object_or_404(Article, id=id_) class ArticleCreateView(CreateView): template_name = 'blog/article_create.html' … -
Universal API for all models
I am new in python(django) and I wanna do universal api for all models in my app with create update insert and delete. and serializer do not have a data when i use it for create and delete. i want response data when i insert and deleted true or false when i delete it. 2 Question is - Is my code and an approach correct or i do something wrong or not correct? Why i ask? cause i just startwed django/ Thank you from collections import namedtuple import null from django.apps import apps from rest_framework.response import Response from .serializers import * from .models import * from rest_framework import generics, viewsets, status class GeneralViewSet(viewsets.ModelViewSet): myModel = null MyApiObj = null @property def api_object(self): return namedtuple("ApiObject", self.request.data.keys())(*self.request.data.values()) @property def model(self): return apps.get_model(app_label=self.MyApiObj.app, model_name=self.MyApiObj.object) def get_serializer_class(self): GeneralSerializer.Meta.model = self.myModel return GeneralSerializer def post(self, request): self.MyApiObj = self.api_object self.myModel = self.model return self.query_type() def query_type(self): if (self.MyApiObj.query == 'SELECT'): return self.select_api() elif (self.MyApiObj.query == 'INSERT'): return self.insert_api(), elif (self.MyApiObj.query == 'UPDATE'): return self.update_api(), elif (self.MyApiObj.query == 'DELETE'): return self.delete_api(), else: return Response('', status=status.HTTP_400_BAD_REQUEST) # print(self.MyApiObj.query) # query_select = { # 'SELECT': self.select_api(), # 'INSERT': self.insert_api(), # 'UPDATE': self.update_api(), # 'DELETE': self.delete_api(), # } # … -
GraphQL Django Graphene microservices: Weaving Rest API into GraphQL endpoint
We have a Monolith code base that we are slowly breaking down into micro-services. The main code base uses django GraphQL via graphene. One service now is accounts. Each account has a route field with an id. I have managed to get the accounts micro-service REST API back into the main graphQL endpoint with the following code sample: class MicroDeliveryRoutesType(ObjectType): id = graphene.ID() routeName = graphene.String() loadingDay = graphene.Int() class MicroAccountNameType(ObjectType): id = graphene.ID() accountCompanyid = graphene.String() commonName = graphene.String() parentAccountid = graphene.Field(lambda: MicroAccountNameType) routeid = graphene.Field(MicroDeliveryRoutesType) class Query(graphene.ObjectType): list_microAccountNames = graphene.List(MicroAccountNameType) list_microDeliveryRoutes = graphene.List(MicroDeliveryRoutesType) def resolve_list_microAccountNames(self, context, *args, **kwargs): url = 'https://routeToAccounts' data = requests.get(url) return json2obj(json.dumps(json.loads(data.content))) def resolve_list_microDeliveryRoutes(self, context, **kwargs): return json2obj(json.dumps([{"routeName":"Test Route", "id":"1"}])) At the moment ALL the routeid fields for all the accounts (there id's and routeNames) are returning null. I know I am only returning one sample set, but I would expect all the accounts that have a routeid == 1 to at least return id=1 and routeName="Test Route" But like I said all my data basically looks like the data below: { "accountCompanyid ": "P70", "commonName": "Company 70", "id": "1", "routeid": { "routeName": null, "loadingDay": null, "id": null }, "parentAccountid": null } How can … -
how to build sign up user with extra field(dropdown list filled from database) from another table?
i want make sign up for user and i make extends user to another field from antoher model , my three field inr egistration is : username ,password ,structure_designation where the last one is a drop down list getted from database and it is filled in photo you see the model.py can u help me to build views .py and forms.py from django.db import models from django.contrib.auth.models import User from immob.models import Structure from django.db.models.signals import post_save from django.dispatch import receiver class Profile(models.Model): user=models.OneToOneField(User,on_delete=models.CASCADE) structure=models.ForeignKey(Structure, on_delete=models.CASCADE,null=True) @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() -
Auth user Django in another database
In the same project I have some apps that should store data in the localhost database and some in a remote database. I created a routers.py file and imported it into my settings.py. I also defined 2 databases in my settings file. Is this the correct one? On some models/class I set app_label = 'remote_db' where I need to write data to the remote database. part of settings.py DATABASES={ 'default':{ ... }, 'remote_db':{ ... } } DATABASE_ROUTERS = ['smart.routers.AccessRouter',] AUTH_USER_MODEL = 'users.SmartUser' AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) part of users/ models.py class SmartUser(AbstractBaseUser, PermissionsMixin): class Meta: app_label = 'remote_db' When i try run makemigrations users i heave the warning/ error: "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'users.SmartUser' that has not been installed -
Can I make the lines thicker on this brushstroke animation I made with an svg in html & css?
I made a svg and animated it to write out my text. I want it to have thick brushstrokes and look similar to this website(http://weaintplastic.com), writing out letters one by one. At the moment it just traces the letters at the same time making it hard to read the word and the lines are very thin. I would like to make the brushstrokes thicker and to animate each letter to write out one at a time with html and css. I created my svg on this website(https://vectr.com/) by using their text function and then sketched the path of each individual letter with the trace tracing each individual letter with the pen tool. I used this link to open the svg https://jakearchibald.github.io/svgomg/ and copied the svg as text. Then I followed the instructions on this website to animate it https://dev.to/oppnheimer/you-too-can-animate-svg-line-animation-jgm. Here's the link to my code https://codepen.io/anon/pen/JgEadZ#anon-signup html with svg path <div id="header"> <div id="content"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="640" height="640"> <defs> <path d="M189.37 447.93l-8.06-17.6-18.94-41.4-17.9 41.76-9.1 21.24" id="a"/> <path d="M259.91 434.47l-.15 7.99-12.14 7.78-26-.48-13.85-8.26-5.63-19.61 12.49-26.27 24.08-4.55 18.82 10.35" id="b"/> <path d="M332.37 436.93l-20 15-20-4-9-11-5-13 5-25 13-10H320l12.37 10" id="c"/> <path d="M402.37 451.93h-47v-63h43" id="d"/> <path d="M398.37 418.43h-43" id="e"/> <path d="M470.46 388.93v61h-7.15l-42.94-61v61" id="f"/> <path d="M538.17 388.93h-53 25v63" … -
Custom Form with Socialaccount in Django-allauth
I'm trying to modify the social account (in my case with Google) sign-up using django-allauth. What I would like to achieve is to have the user click my "Sign-up with Google" button, but after Google login (on the callback) I would like to present the user with a consent form (regarding rules/GDPR) which he needs to submit before finalising the procedure. Here's my form: // landing/forms.py from allauth.socialaccount.forms import SignupForm class GoogleSignUpForm(SignupForm): privacy_policy = forms.BooleanField( required=True, label=_('I accept the privacy policy and rules '), help_text=_('You need to accept this to proceed with setting-up your account') ) def __init__(self, sociallogin=None, **kwargs): super(GoogleSignUpForm, self).__init__(**kwargs) terms_and_conditions = reverse_lazy('privacy') self.fields['privacy_policy'].label = mark_safe(_( "I have read and agree with the " "<a href='%s'>Terms and Conditions</a>")) % ( terms_and_conditions) def save(self): user = super(GoogleSignUpForm, self).save() return user I have the following setting in my base.py setting file: SOCIALACCOUNT_FORMS = {'signup': 'landing.forms.GoogleSignUpForm'} And yet - the import line from allauth.socialaccount.forms import SignupForm is giving me the following error: django.core.exceptions.ImproperlyConfigured: Error importing form class landing.forms: "cannot import name 'BaseSignupForm'" Why is this happening and how to make this work?