Pavel
«dirty fields» means fields which were updated the last time
Pavel
Ok, I’ve shortened the code snippet to the link: http://paste.org.ru/?c067jx
Pavel
I need some equivalent in Django world for this
Pavel
Oh, it seems like I found something: https://pypi.org/project/django-observer/
Randy
https://github.com/alechries/MyHouse24Django/blob/master/MyHome24/apps/_db/models.py#L87
I make migrations and have exception:
django.db.utils.OperationalError: no such table: _db_user
_db - app
user - custom user model
Tukhtamurod
Tukhtamurod
I'm doing the first migration
if you are doing first migration, try deleting migration folders in every app, delete dbsqlite3 file, and run:
python manage.py makemigrations
python manage.py migrate
let me know if it doesnt help
Randy
Tukhtamurod
if it again shows error, i dont know in this case, you should have done smth wrong, because this should always work
Anonymous
hello can someone help me?
Anonymous
i want to to give permission to users for seeing my webpages
Anonymous
but i cant
Anonymous
who know this?
shashikant
Anonymous
Anonymous
i have models permission
Tukhtamurod
Anonymous
Anonymous
they shouldnt use admin page
Tukhtamurod
if you mean different admin page, then there is a field is_stuff to use
Anonymous
Anonymous
second have to show shop
Anonymous
like this i have to do
Tukhtamurod
Anonymous
Tukhtamurod
i cant explain fully😔
for a particular url user visiting, you want to return different templates according to whether the user is admin or not, right?
Anonymous
for example
when a user visits a website they should see what I allow and not what I do not allow
Anonymous
can u understand me?
Tukhtamurod
Tukhtamurod
for admin or not admin case, django's built in User model is enough
Anonymous
i will create users and i want to add type of users
Bekhruz
🏁 🏁 🏁
is it possible to hide what is displayed via Django in the source code (view-source)?
Anonymous
for example stuff should see only shop and cashier should see only cash page and admin can see all pages
Anonymous
Anonymous
but i dont want like that
Tukhtamurod
Anonymous
class Permission(models.Model):
kod = models.IntegerField()
name = models.CharField(max_length=255)
Anonymous
i have this
Anonymous
class Daraja(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
chois = (
('Kassir', 'Kassir'),
("Sotuvchi", "Sotuvchi"),
("Omborchi", "Omborchi"),
("Admin", "Admin"),
("Call center", "Call center"),
)
status = models.CharField(choices=chois, max_length=255, default="")
permission = models.ManyToManyField(Permission)
Anonymous
and i cant do in views
Anonymous
how to send
Tukhtamurod
what does permission do here?
Tukhtamurod
you need to study database concepts first, it is in complete mess
Anonymous
do u have videocourse?
Tukhtamurod
alright, try to understand I will tell you one way:
1. create UserType table, add all the types you have
class UserType:
name = models.CharField(choices=choices, ......)
2. create Relational model UserOfType:
class UserOfType:
user = models.OneToOneField(User, ......, related_name="type")
type = models.ManyToOneField(UserType, .......)
then in your view function you can identify user type using
user.type.type.name
Anonymous
thanks i'll try
Tukhtamurod
alright, try to understand I will tell you one way:
1. create UserType table, add all the types you have
class UserType:
name = models.CharField(choices=choices, ......)
2. create Relational model UserOfType:
class UserOfType:
user = models.OneToOneField(User, ......, related_name="type")
type = models.ManyToOneField(UserType, .......)
then in your view function you can identify user type using
user.type.type.name
the reason why I use OneToOneField on User model, because a user can only be of one type, not more, for example, a user cannot be both omborci and admin at the same time, the reason Why i used ManyToOneField on type, because in that company there may be 10 Cashiers.
190032029
i ma unable to install django in my pycharm could you guys please help me out in doing it ??
190032029
thank you
Roman
Can someone explain me how do we deal with migrations when a few people work on the project ?
Jay
I am not getting a URL from django server
Roman
Jay
Yes it is happening
Vinay
Which framework is Best and Beneficial for making API :-
Django vs Django Rest Framework
Sujit
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. anyone know about this (using vs code)?????
Vinay
Plz reply
Vinay
Which framework is Best and Beneficial for making API :-
Django vs Django Rest Framework
Devu
Django Rest Framework
Rohan
Maset
Is there any way to use our GitHub repo itself as a simple S3 bucket?
Rohan
Rohan
Maset
Rohan
Maset
Rohan
Why’d you use “github” to replace S3?
Rohan
That’s actually not a smart thing to do
Sujit
Maset
I have a simple project and I need a S3 bucket and I don't have enough credit for purchasing one so
Rohan
Object level encryption, object level public private access? There are n number of issues that will come forth