Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Authenticating Users In Django With SSH Keys
I would like to users of my REST API written in Django to be able to authenticate using SSH keys. What I am doing is I have created an API to allow me to release software to my website via the command line. I want to authenticate using my ssh key when accessing that API. So I have in my user interface that I can add public ssh keys associated with my user account. Now how do I validate the keys in order to authenticate? What is it that I have to do? I have my API client that will make a post call to: https://examlple.com/api/release/ How can validate keys!? I have found a couple of python libraries but they are incomplete or unclear. Any step in the right direction would be helpfl. -
Django - Select multiple groups while creating new object
I am trying to create a django form where new objects should be created and one or more groups should be assigned (to view or edit) that objects. The problem is that in the db, not only the selected groups are save, but all groups where user has access. Here is what I tried: forms.py class MyForm(forms.ModelForm): Groups = forms.ModelMultipleChoiceField(queryset=Group.objects.all(),widget=forms.CheckboxSelectMultiple) class Meta: model = MyModel fields = ('Name','Groups') def __init__(self, user, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['Groups'].queryset=Group.objects.filter(user=user) Models.py class MyModel(models.Model): Name = models.CharField(max_length=50) Groups = models.ManyToManyField(Group) def __str__(self): return str(self.Name) Views.py def CreateObject(request): form = MyForm(request.user, request.POST) if request.method == 'POST': if form.is_valid(): publish = form.save(commit=False) Name = form.cleaned_data.get('Name') user = request.user groups = Group.objects.filter(user=request.user) instance = MyModel.objects.create(Name=Name) instance.Groups.set(groups) return HttpResponseRedirect('/') return render(request, 'pages/CreateObject.html', {'form' : form}) Can you help me figuring out how to save only the selected groups, not all groups where an user has access? Thanks! -
How to use labels resource file in Django like in .Net? [duplicate]
This question already has an answer here: Django - How to make a variable available to all templates? 2 answers My question is how to use labels or resource management like in .Net for example in .net we can define a key and value for a string so we can use every where like ( website title ) by just calling that key so later if you used the label 100 times and need to change is we can change in one place which teh resource file. <asp:Label ID="Label1" Text="<%$Resources:Resource, Greetings %>" runat="server" Font-Bold="true" /> ((( here we called teh greeting key to be teh value for teh label text))) how can we do this in Django #Django -
Does setting a unique_together cause droping of duplicates upon migration?
I have duplicates, for a pair of fields, in my database which I would like to drop. Can I do this by simply setting unique_together on the pair and migrating? I am using Django 2.0. Here is the model(with the unique_together already added): class Candle(models.Model): symbol = models.CharField(max_length=32) name = models.CharField(max_length=32) timestamp = models.DateTimeField() open = models.FloatField() high = models.FloatField() low = models.FloatField() close = models.FloatField() volume = models.FloatField() def __str__(self): return 'Candlestick for {} at {}.'.format(self.symbol, self.timestamp) class Meta: indexes = [ models.Index(fields=['symbol']), models.Index(fields=['timestamp']) ] unique_together = (('symbol', 'timestamp'),) Otherwise what is the best way to drop these duplicates, and avoid the insertion of new ones? -
Multifactor Authenticator in Django Rest Framework using Deux
I want to use multifactor authentication in my app which is built by using Djangorest Framework and angular. I want to use google authenticator for it. I found the library Deus in Django rest. It is difficult to integrate google authenticator. How can I do it? -
How to filter and query objects of a 3rd model based on fields of Profile model?
I am creating a management system for my college. I am new to django and please guide me through. Find this project repository or clone it : https://github.com/VickramMS/student-analytica.git So here is my question. I have three models. The User model, a Profile model (OneToOne-Relationship with User model), an Attendancee model (ForeignKey relationship with User model). Profile Model: class Profile(models.Model): #YEAR=Choices #DEPT=Choices user=models.OneToOneField(User,on_delete=models.CASCADE) Year=models.CharField(choices=YEAR) Department=models.Charfield(choices=DEPT) Attendancee model: class Attendancee(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) Hour = models.CharField(max_length=1, blank=True, help_text="Hour") subject = models.CharField(max_length=8, blank=True, help_text="Subject") date = models.DateTimeField(auto_now_add=True) presence = models.BooleanField(default=False) def __str__(self): return f'{self.user.username}' The objective is, i need to make filter fields in the template so that the staff can filter the students based on YEAR(Profile filed) and DEPARTMENT(Profile field) and display the forms to enter the value in the Attendancee model. So i tried this is my view from user.models import Attendancee def academics: if request.user.is_staff: context = { 'queryset': Attendance.objects.filter(user=User.objects.filter(profile__Year='FY').filter(profile__Department='CSE').values_list('username') #FY and CSE are choices return render(request, 'console/academics.html',context) else: ... The above snippet throws an error that the list goes out of range. I know that the problem is, when i query this, User.objects.filter(profile__Year='FY').filter(profile__Department='CSE').values_list('username') it will return a query set and not a single query, so that the filter … -
I am trying to implement blog app with Django.In my profile model i set on delete cascade but its not working?
I am trying to implement blog app with Django.I created profile model for profile image where id from auth_user model is foreign key in profile model.And i given on delete = cascade in profile model.But if i delete a user from auth_user in pgadmin 4 it says "update or delete on table "auth_user" violates foreign key constraint "blog_profile_user_id fk_auth_user_id" on table "blog_profile" models.py class Profile(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) image = models.ImageField(default='default.jpg',upload_to='pics') -
Multiple self referenced ForeignKey relationship fields in Django model
Wich way should I create multiple self referenced ForeignKey fields in Django model? My current Model looks like: class WordCoreModel(models.Model, BaseModel): word_core = models.CharField(max_length=255, default="") word_russian_typed = models.CharField(max_length=255, default="", blank=True) word_english_typed = models.CharField(max_length=255, default="", blank=True) homonym = models.ForeignKey( 'self', on_delete=models.CASCADE, null=True, blank=True, related_name="core_words", related_query_name='homonym') synonym = models.ForeignKey( 'self', on_delete=models.CASCADE, null=True, blank=True, related_name="core_words", related_query_name='synonym') antonym = models.ForeignKey( 'self', on_delete=models.CASCADE, null=True, blank=True, related_name="core_words", related_query_name='antonym') class Meta: indexes = [models.Index(fields=['word_core'])] verbose_name = 'Core Word' verbose_name_plural = 'Core Words' def __str__(self): return self.word_core Please give me some best-practices examples. I searched a lot for different solutions. I don’t find examples when there are several fields in the model. -
Django API: grabing Nested Json for UnitTest
I have api end point and trouble in garbing item from nested json... I am writing test like this and printing what data it me appears: class TestSingleArticle(TestCase): def setUp(self): article = ArticleFactory2.create() self.url = reverse('article-single2', args=[article.alias]) def test_single_article_get(self): request = self.client.get(self.url) print(request.data) When i run this, i see following json in terminal {'alias': '508674f2-b570-47f1-b1d8-01592a3af359', 'author': OrderedDict([('id', 1), ('organization', OrderedDict([('id', 1), ('organization_name', 'org name'), ('contact', '256644')])), ('name', 'jhon doe'), ('detail', 'this is detail')]), 'category': OrderedDict([('id', 1), ('name', 'sci-fi')]), 'title': 'i am title', 'body': 'i am body'} I am trying grab contact from above json but i failed.... -------------------- If you dont understand above statement, see these optional hint for you. This is my serilization class: from rest_framework import serializers from . models import Author, Article, Category, Organization class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = '__all__' class AuthorSerializer(serializers.ModelSerializer): organization = OrganizationSerializer(): class Meta: model = Author fields = '__all__' class CategorySerializer(serializers.ModelSerializer): class Meta: model = Category fields = '__all__' class ArticleSerializer(serializers.ModelSerializer): author = AuthorSerializer() category = CategorySerializer() class Meta: model = Article fields = '__all__' and below are my models: from django.db import models import uuid class Organization(models.Model): organization_name = models.CharField(max_length=50) contact = models.CharField(max_length=12, unique=True) def __str__(self): return self.organization_name … -
Django urlpatterns regex is imprecise, getting 404?
I'm working on Django API URLs, and trying to recognize this type of HTTP request: DELETE http://localhost:8000/api/unassigned_events/dddd-dd-dd/d or dd/ - d for digit, whilst saving each sector in an argument. e.g. DELETE http://localhost:8000/api/unassigned_events/2019-06-20/1/ My regex path expression is: path(r'^api/unassigned_events/(?P<date>[0-9]{4}-[0-9]{2}-[0-9]{2})/(?P<cls_id>[0-9]{1,2})/$', UnassignedClassRequests.as_view(), name='delete') The HTTP request is the given example above, but I'm receiving a 404 error instead of the view's functionality. Here's the to-be-called view method: class UnassignedClassRequests(APIView): @staticmethod def delete(request): UnassignedEvents.objects.filter(date=request.date, cls_id=request.cls_id).delete() return HttpResponse(status=status.HTTP_201_CREATED) and the error I'm getting on Chrome: DELETE http://localhost:8000/api/unassigned_events/2019-06-20/1/ 404 (Not Found). I've also tried this regex expression for the path, not succeeding: path(r'^api/unassigned_events/(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})/(?P<cls_id>[0-9]{1,2})/$' UnassignedClassRequests.as_view(), name='delete') What am I doing wrong? -
__init__() got an unexpected keyword argument 'use_required_attribute'
I don't know why in some pages give me this error, and in others dosen't show me the error I try to add a requiered attrbute but dosen't work, I don't how to add it Model class Vehicle(models.Model): registration = models.CharField(max_length=200, default='') vehicle_type = models.ForeignKey(VehicleType, on_delete=models.CASCADE) def __str__(self): return self.registration class Meta: verbose_name_plural = "Vehicles" Form class VehicleForm(ModelForm): class Meta: model = Vehicle fields = ['registration', 'vehicle_type'] View def vehicles(request): vehicles = Vehicle.objects.all() context = { 'title' : 'Vehicles', 'generic_objects' : vehicles } return render(request, 'vehicle/index.html',context) def vehicle(request, id): VehicleFormSet = modelformset_factory(Vehicle, exclude=(), extra=0) #Add a vehicle if request.method == 'POST': formset = VehicleFormSet(request.POST, request.FILES) if formset.is_valid(): formset.save() return HttpResponseRedirect('/favorita/vehicles') #Edit the vehicle else: vehicles_search = Vehicle.objects.filter(id = id) if vehicles_search: formset = VehicleFormSet(queryset=vehicles_search) else: formset = formset_factory(VehicleForm) return render(request, 'vehicle/details.html', {'formset': formset, 'id':id, 'title':"Vehicle"}) def delete_vehicle(request, id): Vehicle.objects.filter(id=id).delete() return HttpResponseRedirect('/favorita/vehicles') The error image -
I am trying to implement blog app with Django.I created registration form with profile pic upload.But its returning IntegrityError
I am trying to implement blog app with Django.I created registration form with profile pic upload.But its returning integrity error null value in column "user_id" violates not-null constraint DETAIL: Failing row contains (7, pics/P_Wk6m1b3.png, null). #models.py class Profile(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) image = models.ImageField(default='default.jpg',upload_to='pics') #views.py def register(request): if request.method == "POST": form = Register(request.POST,request.FILES) if form.is_valid(): profile = Profile() email = form.cleaned_data['Email'] User_name=form.cleaned_data['Username'] Password=form.cleaned_data['Password'] Confirm_Password=form.cleaned_data['Confirm_Password'] firstname=form.cleaned_data['Firstname'] user=User.objects.create_user(username=User_name, password=Password,email=email,first_name=firstname) user.save(); insert = Profile(image = request.FILES['picture'], user_id=request.user.id) insert.save() return redirect('/') else: form = Register() return render(request,'register.html',{'form': form}) #forms.py class Register(forms.Form): Email = forms.EmailField(widget=forms.TextInput(attrs= {"class":"inputvalues"})) Username = forms.CharField(widget=forms.TextInput(attrs= {"class":"inputvalues"})) Password = forms.CharField(widget=forms.PasswordInput(attrs= ({"class":"inputvalues"}))) Firstname = forms.CharField(widget=forms.TextInput(attrs= {"class":"inputvalues"}),max_length=30) Lastname = forms.CharField(widget=forms.TextInput(attrs= {"class":"inputvalues"}),max_length=40) Confirm_Password = forms.CharField (widget=forms.PasswordInput(attrs=({"class":"inputvalues"}))) Image = forms.ImageField() def clean_Email(self): if validate_email(self.cleaned_data['Email']): raise forms.ValidationError("Email is not in correct format!") elif User.objects.filter(email = self.cleaned_data['Email']) .exists(): raise forms.ValidationError("Email aready exist!") return self.cleaned_data['Email'] def clean_Username(self): if User.objects.filter(username = self.cleaned_data['Username']).exists(): raise forms.ValidationError("Username already exist!") return self.cleaned_data['Username'] def clean_Confirm_Password(self): pas=self.cleaned_data['Password'] cpas = self.cleaned_data['Confirm_Password'] if pas != cpas: raise forms.ValidationError("Password and Confirm Password are not matching!") else: if len(pas) < 8: raise forms.ValidationError("Password should have atleast 8 character") if pas.isdigit(): raise forms.ValidationError("Password should not all numeric") <!-------register.html> {% extends 'layout.html' %} {% block content %} <div class="box"> <h2> <center>Register</center> … -
How to return a html page when user send a post request in Django Rest framework
i want to return a HTML page with value posted posted by user in django restframework Model i have created is class DetailView(viewsets.ModelViewSet): queryset= Detail.objects.all() serializer_class = DetailSerializer @action(methods=['GET'],detail=False) def get(self,request): first_name= request.POST.get("first_name") last_name = request.POST.get("last_name") return redirect ('index.html/') url: router = routers.DefaultRouter() router.register('detail',views.DetailView) index.html: {{first_name}} {{last_name}} i want to automatically return a html page with value posted by them -
How to change schema per request with Django & Oracle?
I need to find some way to change schema per request on Django & Oracle. is there any way ? thanks -
How to separate 2 signals in one handler in Django
Question is – is it possible in the handler function specified bellow distinguish a situation when it receives post_save or post_delete signal accordingly. I mean in general, but not by implicit characteristics like presence or lack of ‘created”, for example. I can divide 2 signals into 2 handlers, butt it would be less convenient... @receiver([post_save, post_delete], sender=Article) def invalidate_by_Article(sender, instance, **kwargs): show_by_heading_page_url = reverse('articles:show_by_heading', args=(instance.foreignkey_to_subheading_id,)) article_content_page_url = reverse("articles:detail", args=(instance.foreignkey_to_subheading_id, instance.id)) article_resurrection_url = reverse("articles:resurrection") main_page_url = reverse('articles:articles_main') urls = [show_by_heading_page_url, article_content_page_url] if not instance.show: urls.extend([article_resurrection_url, main_page_url]) if kwargs.get("created"): urls.append(main_page_url) list(find_urls(urls, purge=True)) -
Production build fails on `RUN npm install && npm cache clean --force` step
Running docker-compose -f production.yml build fails at Step 4/36 : RUN npm install && npm cache clean --force. It complains that "npm WARN deprecated set-value@2.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version." I've had a look at what depends on set-value and it looks like there's 3 or 4 packages that require it. Running this on local.yml warns but does not fail to build. -
Django Serlizing multiple foreginkey related models
I am having trouble in showing cross relation data in my api end-point this is my serlization class: class ArticleSerializer(serializers.ModelSerializer): # these two variables are assigned coz, author and category are foregin key author = serializers.StringRelatedField() category = serializers.StringRelatedField() class Meta: model = Article fields = '__all__' Above serialization working fine but not satisfy needs. And this is my models from django.db import models import uuid class Organization(models.Model): organization_name = models.CharField(max_length=50) contact = models.CharField(max_length=12, unique=True) def __str__(self): return self.organization_name class Author(models.Model): name = models.CharField(max_length=40) detail = models.TextField() organization = models.ForeignKey(Organization, on_delete=models.DO_NOTHING) def __str__(self): return self.name class Category(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Article(models.Model): alias = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name='author') title = models.CharField(max_length=200) body = models.TextField() category = models.ForeignKey(Category, on_delete=models.CASCADE) this is my views: class ArticleSingle(RetrieveAPIView): queryset = Article.objects.all() serializer_class = ArticleSerializer lookup_field = 'alias' and currently my end-point showing like these but i dont like it: HTTP 200 OK Allow: GET, HEAD, OPTIONS Content-Type: application/json Vary: Accept { "alias": "029a4b50-2e9a-4d35-afc6-f354d2169c05", "author": "jhon doe", "category": "sic-fi", "title": "title goes here", "body": "this is body" } I want the end-point should show the data with author details like, author, organization_name, contact, etc if you dont … -
What is multi-tenant architecture in Django web development?
I have been working on website development in Django with multi-tenant architecture. I have searched many reference online but not able to find any satisfactory answer. What is multi-tenant architecture & how could I use it in my Django website. -
Django 2.2 - Testing response context with assertQuerySetEqual fails
Trying to test response context in Django TestCase with assertQuerysetEqualbut it fails. I tried printing count of Country.objects.all().count() and response.context['countries'].count(). both returns 1 as I create one record at start of the test. Also tried ordered=True on assertion method but no luck still fails the test. Am I missing something or need do it other way? View that returns response class CountriesListView(generic.ListView): model = Country template_name = 'management/countries/countries.html' context_object_name = 'countries' Test using class CountryTest(TestCase): def setUp(self): self.countries_list_url = '/countries' def test_response_returns_countries_context(self): Country.objects.create( name='India', iso_3166_1='IN' ) response = self.client.get(self.countries_list_url) self.assertQuerysetEqual(Country.objects.all(), response.context['countries']) Error I'm getting AssertionError: Lists differ: ['<Country: Country object (1)>'] != [<Country: Country object (1)>] First differing element 0: '<Country: Country object (1)>' <Country: Country object (1)> - ['<Country: Country object (1)>'] ? - - + [<Country: Country object (1)>] -
django rest frame work show all apis in homepage
i am having a django project with 2 apps first called facility and the other called booking and my structure looks like below : now in my urls if u see i can only show booking or facility in my home page api root like below : now i want to know what should i write in my urls.py to list all apis in root api and see them all here !!! -
What are the uses and benifits of get_quert_set() and get_context_data()? Can we use both of them together inside a view?
I was going through Django documentations and I encountered two methods of showing object's data. I am wondering if we can use both get_query_set() and get_context_data inside a single view. For example if I have 3 models named Publisher, Books, Author where Books and Author are related to each other with ManyToMany field and Books and Publisher are related via ForeignKey. There is a view template_name='some_name.html' There are 2 methods of showing data via getting the objects. self.Publisher=get_object_or_404(Publisher,name=self.kwargs('name_of_publisher') return Books.objects.filter(publisher=self.publisher) I think it will return all the Book objects that are related to name_of_publisher. I want to ask how the data will be displayed? Will there be a loop in templates? How will the Url look like and if there is no context defined then how will it show data? 2nd method I came across is def get_context_data(self,**kwargs): context=super().get_context_data(**kwargs) context['publisher']=self.publisher return context I found the working of this one very confusing. I am unable to understand how is this working here. I have read another posts too here just in case you'll try to give me a link. Thanks for that in advance. But what I know is can both of these be used inside a single template and ListView? … -
How can I insert file object in xlsx sheet with python?
I have an app which will download an excel file on button click.I have a FileField stored in the database which i would like to insert in that .xlsx file so that it appears as an icon. I have tried using xlsxwriter and openpyxl libraries and I dont think they can insert objects.If you know any other library for the job That'll be helpful. class SearchView(View): def WriteToExcel(self,item): output = io.BytesIO() **workbook = xlsxwriter.Workbook(output)**; worksheet_s=workbook.add_worksheet("Reports") header = workbook.add_format({ #some format }) worksheet_s.write('A1', "Date",header) #Some Headings worksheet_s.write('E1', "Attachment",header) row = 1 for data in item: worksheet_s.write(row, 0, data.date) #Write stuff **worksheet_s.write(row, 4,data.document)**#Here I want the file to be inserted as an icon row += 1 workbook.close() xlsx_data = output.getvalue() return xlsx_data def post(self,request): response = HttpResponse(content_type='application/vnd.ms-excel') response['Content-Disposition'] = 'attachment; filename=Report.xlsx' xlsx_data = self.WriteToExcel(item) response.write(xlsx_data) return response -
How to pass data for OneToOneField when testing?
I've a signupView that shows 2 forms: SignUpForm and ProfileForm. Basically SignUpForm collects data like first_name, last_name, user_name, email, password1, password2. And ProfileForm collects data like dni, birthdate, shipping_address, etc. I'm testing the ProfileForm but I don't know how to pass the information for the user field of the Profile Model, is is a OneToOneField to the User model. models.py: class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) birthdate = models.DateField(null=True, blank=True) dni = models.CharField(max_length=30, blank=True) phone_number = models.CharField(max_length=30, blank=True) shipping_address1 = models.CharField(max_length=100, blank=False) reference = models.CharField(max_length=100, blank=False) shipping_department = models.CharField(max_length=100, blank=False) shipping_province = models.CharField(max_length=100, blank=False) shipping_district = models.CharField(max_length=100, blank=False) photo = models.ImageField(upload_to='profile_pics', default='profile_pics/default_profile_pic_white.png') def __str__(self): return str(self.user.first_name) + "'s profile" test_forms.py: from django.test import TestCase from django.utils import timezone from django.urls import reverse from shop.forms import SignUpForm, ProfileForm import datetime #coverage run manage.py test shop/tests -v 2 class SignUpFormTest(TestCase): def test_signup_form(self): form_data = {'first_name': 'oma', 'last_name': 'gonza', 'username': 'omagonza', 'email': 'oma.gonzales@gmail.com', 'password1': 'caballo123', 'password2': 'caballo123'} form = SignUpForm(data=form_data) self.assertTrue(form.is_valid()) def test_profile_form(self): district_list = 'Lima' province_list = 'Lima' department_list = 'Lima' form_data = {'user': #¿?¿?¿? 'dni': 454545, 'phone_number': 96959495, 'birthdate': datetime.datetime.now(), 'shipping_address1': 'Urb. Los Leones', 'shipping_address2': 'Colegio X', 'shipping_department': 'Lima', 'shipping_province': 'Lima', 'shipping_province': 'Ate'} form = ProfileForm(district_list=district_list, province_list=province_list, department_list=department_list, data=form_data) self.assertTrue(form.is_valid()) AttributeError: … -
manage.py test: error: argument -v/--verbosity: expected one argument
I'm learning testing. I want to test a SignupForm I have, and for that I'm using the package coverage. However, when running: coverage run manage.py test shop/tests -v I get: $ coverage run manage.py test shop/tests -v usage: manage.py test [-h] [--noinput] [--failfast] [--testrunner TESTRUNNER] [-t TOP_LEVEL] [-p PATTERN] [-k] [-r] [--debug-mode] [-d] [--parallel [N]] [--tag TAGS] [--exclude-tag EXCLUDE_TAGS] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [test_label [test_label ...]] manage.py test: error: argument -v/--verbosity: expected one argument (stickers-gallito-app) shop/tests/test_forms.py: from django.test import TestCase from django.utils import timezone from django.urls import reverse from shop.forms import SignUpForm #coverage run manage.py test shop/tests -v class SignUpFormTest(TestCase): def test_signup_form(self): form_data = {'first_name': 'oma', 'last_name': 'gonza', 'username': 'omagonza', 'email': 'oma.gonzales@gmail.com', 'password1': 'caballo123', 'password2': 'caballo123'} form = SignUpForm(data=form_data) self.assertTrue(form.is_valid()) shop/forms.py: class SignUpForm(UserCreationForm): error_messages = { 'password_mismatch': "Las contraseñas no coinciden.", } first_name = forms.CharField(label="Nombre", max_length=100, required=True) last_name = forms.CharField(label='Apellido', max_length=100, required=True) username = forms.CharField(label='Nombre de usuario', max_length=100, required=True, error_messages={'invalid': "you custom error message"}) email = forms.EmailField(label='Correo electrónico', max_length=60, required=True) password1 = forms.CharField(label='Contraseña', widget=forms.PasswordInput) password2 = forms.CharField(label='Confirmar contraseña', widget=forms.PasswordInput) def __init__(self, *args, **kwargs): super(SignUpForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password1', 'password2']: self.fields[fieldname].help_text = None def clean_password2(self): password1 = self.cleaned_data.get("password1") password2 = self.cleaned_data.get("password2") if … -
Newbie to Github: how to view work in progress
I'm pretty new to coding, so am trying to explore and learn as much as possible. I've been playing around with Github and exploring some more complex repos (the team is using Django and React) - how can you load this more complex code to see a work in progress? For HTML and CSS I understand how you can load a work in progress and see how things are going, but I'm completely lost with these more robust repos with a lot of different languages and files going on. I tried downloading the repo and just reading through the code, and just tried playing around to see if I can load the website, but nothing was working...