Django 3 'User' object has no attribute 'admin'
\*\*SITUATION\*\*
​
\- I am modifying this \[GitHub\]([https://github.com/divanov11/crash-course-CRM/tree/Part-22-S3-File-storage](https://github.com/divanov11/crash-course-CRM/tree/Part-22-S3-File-storage)) project from this \[YouTube Series\]([https://www.youtube.com/watch?v=inQyZ7zFMHM&list=PL-51WBLyFTg2vW-\_6XBoUpE7vpmoR3ztO&index=22](https://www.youtube.com/watch?v=inQyZ7zFMHM&list=PL-51WBLyFTg2vW-_6XBoUpE7vpmoR3ztO&index=22)) and this is a \[demo\]([https://dennisivy-crm.herokuapp.com/](https://dennisivy-crm.herokuapp.com/)) how the original application runs.
\- My goal is to add settings option for Merchant(in the code Admin or AdminUser) accounts in the marketplace, because in the original project only buyers have the option to add image and their contact details.
​
​
\*\*CODE\*\*
​
[model.py](https://model.py)
\`\`\`
#database table create
class Customer(models.Model):
#empty fields accept - null=True
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200, null=True)
profile_pic = models.ImageField(default="profile1.png", null=True, blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
#show customer name in admin panel
def __str__(self):
return self.name
class Adminuser(models.Model):
#empty fields accept - null=True
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200, null=True)
profile_pic = models.ImageField(default="profile1.png",
/r/djangolearning
https://redd.it/hbjnu4
\*\*SITUATION\*\*
​
\- I am modifying this \[GitHub\]([https://github.com/divanov11/crash-course-CRM/tree/Part-22-S3-File-storage](https://github.com/divanov11/crash-course-CRM/tree/Part-22-S3-File-storage)) project from this \[YouTube Series\]([https://www.youtube.com/watch?v=inQyZ7zFMHM&list=PL-51WBLyFTg2vW-\_6XBoUpE7vpmoR3ztO&index=22](https://www.youtube.com/watch?v=inQyZ7zFMHM&list=PL-51WBLyFTg2vW-_6XBoUpE7vpmoR3ztO&index=22)) and this is a \[demo\]([https://dennisivy-crm.herokuapp.com/](https://dennisivy-crm.herokuapp.com/)) how the original application runs.
\- My goal is to add settings option for Merchant(in the code Admin or AdminUser) accounts in the marketplace, because in the original project only buyers have the option to add image and their contact details.
​
​
\*\*CODE\*\*
​
[model.py](https://model.py)
\`\`\`
#database table create
class Customer(models.Model):
#empty fields accept - null=True
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200, null=True)
profile_pic = models.ImageField(default="profile1.png", null=True, blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
#show customer name in admin panel
def __str__(self):
return self.name
class Adminuser(models.Model):
#empty fields accept - null=True
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200, null=True)
profile_pic = models.ImageField(default="profile1.png",
/r/djangolearning
https://redd.it/hbjnu4
GitHub
GitHub - divanov11/crash-course-CRM at Part-22-S3-File-storage
Django customer management platform. Contribute to divanov11/crash-course-CRM development by creating an account on GitHub.
how does pewee ORM work with heroku for postgress?
Hi there I use peewee for flask and it works fine, even with postgres locally. But, when I go to heroku there is where I am unsure how to proceed. Do I need to statistically type the postgres heroku info ? I cannot seem to find the answer in heroku, some people recommend this #DATABASE=PostgresqlDatabase('heroku'), but it did not work for me. Again thank you!!
​
​
​
DATABASE = PostgresqlDatabase(
'',
user='',
password='', # Ditto.
host='') # Ditto.
​
​
​
​
​
​
​
Thanks
flask-bcrypt==0.7.1 Flask==1.1.1 Flask-CLI==0.4.0 Flask-Login==0.5.0 flask-marshmallow==0.11.0 Flask-Migrate==2.5.3 Flask-Script==2.0.6 Flask-SQLAlchemy==2.4.1 Flask-WTF==0.14.3 gunicorn==20.0.4 bcrypt==3.1.4 flask-peewee==3.0.3 Flask-WTF==0.14.3 Jinja2==2.11.1 lazy-object-proxy==1.4.3 regex==2020.4.4 requests==2.23.0 slugify==0.0.1 SQLAlchemy==1.3.16 sqlparse==0.3.1 urllib3==1.25.8 utils==1.0.1 wcwidth==0.1.9 Werkzeug==1.0.1 wtf-peewee==3.0.0 WTForms==2.2.1
/r/flask
https://redd.it/led12p
Hi there I use peewee for flask and it works fine, even with postgres locally. But, when I go to heroku there is where I am unsure how to proceed. Do I need to statistically type the postgres heroku info ? I cannot seem to find the answer in heroku, some people recommend this #DATABASE=PostgresqlDatabase('heroku'), but it did not work for me. Again thank you!!
​
​
​
DATABASE = PostgresqlDatabase(
'',
user='',
password='', # Ditto.
host='') # Ditto.
​
​
​
​
​
​
​
Thanks
flask-bcrypt==0.7.1 Flask==1.1.1 Flask-CLI==0.4.0 Flask-Login==0.5.0 flask-marshmallow==0.11.0 Flask-Migrate==2.5.3 Flask-Script==2.0.6 Flask-SQLAlchemy==2.4.1 Flask-WTF==0.14.3 gunicorn==20.0.4 bcrypt==3.1.4 flask-peewee==3.0.3 Flask-WTF==0.14.3 Jinja2==2.11.1 lazy-object-proxy==1.4.3 regex==2020.4.4 requests==2.23.0 slugify==0.0.1 SQLAlchemy==1.3.16 sqlparse==0.3.1 urllib3==1.25.8 utils==1.0.1 wcwidth==0.1.9 Werkzeug==1.0.1 wtf-peewee==3.0.0 WTForms==2.2.1
/r/flask
https://redd.it/led12p
reddit
how does pewee ORM work with heroku for postgress?
Hi there I use peewee for flask and it works fine, even with postgres locally. But, when I go to heroku there is where I am unsure how to...
How will you use the new Django 5.0 GeneratedField?
I'm pretty exciting by this new feature and I was wondering how I could benefit from it.
My first question: are properties still relevant?
For example, something like:
could be easily replaced by a generated field. However, as it's not a CPU intensive task, I'm not sure I'd benefit from it.
Then I was thinking of annotations. In some cases, they can be a little painful to write, and I always have to remember if my queryset is contains the annotation or not. However, what if I replace annotation by a generated field, will it create an overhead, in a sense that it will compute stuff when I may not require it. Maybe the
I'd be glad to know how are you going to use this welcome feature.
/r/django
https://redd.it/18b8pk6
I'm pretty exciting by this new feature and I was wondering how I could benefit from it.
My first question: are properties still relevant?
For example, something like:
@property
def full_name(self) -> str:
return f"{self.first_name} {self.last_name}"
could be easily replaced by a generated field. However, as it's not a CPU intensive task, I'm not sure I'd benefit from it.
Then I was thinking of annotations. In some cases, they can be a little painful to write, and I always have to remember if my queryset is contains the annotation or not. However, what if I replace annotation by a generated field, will it create an overhead, in a sense that it will compute stuff when I may not require it. Maybe the
persist_db is the answer to this question?I'd be glad to know how are you going to use this welcome feature.
/r/django
https://redd.it/18b8pk6
Django Project
Django 5.0 release notes | Django documentation
The web framework for perfectionists with deadlines.