George
cj
George
I think there are decorators for that
cj
Mirco
George
I havent implemented it but i know a bit
cj
looks like he is
Mirco
Krunal
I don't have permission to send media in this group.
George
George
We should promote pastebin like services like 10000x compression, efficient, cheap omg
Mayank
hi
Mayank
any one is there
Mayank
i want to add extra fileds to the user which shows to the admin page and remove is_staff and user permission ...how to do that please help
Neo
can anybody tell me how can i send additional modelform of different model with current model
Mehul
SMTPSenderRefused at /password-reset/
(530, b'5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError z62sm8168280pfi.4 - gsmtp', 'webmaster@localhost')
Mehul
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')
setting.py file
Mehul
path('password-reset/',
auth_views.PasswordResetView.as_view(
template_name='users/password_reset.html'
),
name='password_reset'),
path('password-reset/done/',
auth_views.PasswordResetDoneView.as_view(
template_name='users/password_reset_done.html'
),
name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(
template_name='users/password_reset_confirm.html'
),
name='password_reset_confirm'),
path('password-reset-complete/',
auth_views.PasswordResetCompleteView.as_view(
template_name='users/password_reset_complete.html'
),
name='password_reset_complete'),
path('', include('blog.urls')),
Mehul
url.py file.
Paritosh
https://stackoverflow.com/questions/54547705/how-to-fix-the-labels-positioned-wrong-in-my-default-django-form
Paritosh
Mayank
i want to add extra fileds to the user which shows to the admin page and remove is_staff and user permission ...how to do that please help
Paritosh
Ronald
Mayank
from django.contrib import admin
from .models import MyUser
class MyUserAdmin(admin.ModelAdmin):
list_display = ('username','email','phone','account_name','account_number','bank_name')
USERNAME_FIELD = 'email'
def str__(self): # __unicode on Python 2
return self.email
admin.site.register(MyUser,MyUserAdmin)
Mayank
admin .py above
Mayank
from django.db import models
from django.contrib.auth.models import AbstractUser
class MyUser(AbstractUser):
phone = models.CharField(max_length = 20)
account_name = models.CharField(max_length = 200)
account_number = models.IntegerField()
bank_name = models.CharField(max_length = 200)
class Meta:
unique_together = ('account_number', 'bank_name')
# class UserManager(BaseUserManager):
# def create_user(self, email,name,phone,account_name,account_number,bank_name,bsb_number, password=None,is_staff=False,is_admin=False):
# if not email:
# raise ValueError('Users must have an email address')
# if not password:
# raise ValueError("Users must have password ")
# user = self.model(
# email=self.normalize_email(email),
# )
# user.set_password(password)
# user.save(using=self._db)
# return user
#
# def create_staffuser(self, email, password=None):
# user = self.create_user(
# email,
# password=password,
# )
# user.staff = True
# user.save(using=self._db)
# return user
#
# def create_superuser(self, email, password):
# user = self.create_user(
# email,
# password=password,
# )
# user.staff = True
# user.admin = True
# user.save(using=self._db)
# return user
#
# # hook in the New Manager to our Model
#
#
# class User(AbstractBaseUser):
# email = models.EmailField(verbose_name='email address',max_length=255,unique=True,)
# active = models.BooleanField(default=True) #can login
# staff = models.BooleanField(default=False) # a admin user; non super-user
# admin = models.BooleanField(default=False) # a superuser
# # notice the absence of a "Password field", that's built in.
# name = models.CharField(max_length = 200)
# phone = models.CharField(max_length = 20)
# account_name = models.CharField(max_length = 200)
# account_number = models.IntegerField()
# bank_name = models.CharField(max_length = 200)
# bsb_number = models.IntegerField()
#
#
# USERNAME_FIELD = 'email'
# REQUIRED_FIELDS = ['name','phone','account_name','account_number','bank_name','bsb_number'] # Email & Password are required by default.
#
# def get_full_name(self):
# return self.email
#
# def get_short_name(self):
# return self.email
#
# def str__(self): # __unicode on Python 2
# return self.email
#
# def has_perm(self, perm, obj=None):
# "Does the user have a specific permission?"
# # Simplest possible answer: Yes, always
# return True
#
# def has_module_perms(self, app_label):
# "Does the user have permissions to view the app app_label?"
# # Simplest possible answer: Yes, always
# return True
#
# @property
# def is_staff(self):
# return self.staff
#
# @property
# def is_admin(self):
# return self.admin
#
# @property
# def is_active(self):
# return self.active
#
# #
# # class Investor(models.Model):
# # name = models.CharField(max_length = 200)
# # email = models.EmailField()
# # phone = models.CharField(max_length = 20)
# # password = models.CharField(max_length = 20)
# # account_name = models.CharField(max_length = 200)
# # account_number = models.IntegerField()
# # bank_name = models.CharField(max_length = 200)
# # bsb_number = models.IntegerField()
# #
# # def __str__(self):
# # return self.name
Mayank
model.py
Ronald
Mayank
DM?
Ronald
Direct Message
Ronald
Private Message
Mayank
okay
Mayank
so how to do that
Ronald
use the chat
Mayank
can you give me any hint
Mayank
how to do that
Mayank
adding some extra fileds in user model and want to remove timestmaps and all that
Ronald
also, remove the code
Ronald
and use
Ronald
Pastebin
Ronald
or
Ronald
dpaste
Ronald
Mehul
Mirco
?
Enable less secure apps on Google
Mirco
Mehul
k
Anonymous
Hii, Any rich text editor for djano. ??
I tried summernote but its shows the data with html tags
Kowalski
Saran maybe try vscode with some django plugins?
George
Anonymous
I think you're not getting his question
Anders (izzno / gooood) π³π΄
I am creating a Django app that "i think" consists of two parts. A pim system which holds information about our products and product models and information around that which will be served over an API && a news/product site pulling information from the pim models and have its own models like articles etc... Would you split these in two different apps and keep the api as a seperate app and import the models as needed in the "site" app? Any thoughts on how to do this ?
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
Student license is free, one month free professional for everyone.
Mirco
Anders (izzno / gooood) π³π΄
Anything special about importing models from another app ?
Anders (izzno / gooood) π³π΄
Namespaces etc will probably not be an issues as the pim will only use DRE
inchidi
Anders (izzno / gooood) π³π΄
That being said, its a full blown IDE. Not comparable to Atom/Sublime/VScode etc... Does not start in ms ;)
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
good point ;)
inchidi
?
not one month free pro but one year free pro
Anders (izzno / gooood) π³π΄
One month free for trial. Unlimited free as long as you are a student.
Anders (izzno / gooood) π³π΄
https://www.jetbrains.com/student/
Mirco
inchidi
Anders (izzno / gooood) π³π΄
The akilles might be that you get spoiled when it comes to autocomplete / linting but your progress will skyrocket.