R
Then probably it would be a good idea to run the selenium script in background with celery for example
R
Or you could also create an independent microservice which does what you need and you call it from django
Orack
https://stackoverflow.com/questions/16180428/can-selenium-webdriver-open-browser-windows-silently-in-background
Orack
opt=webdriver.ChromeOptions() opt.arguments.append("headless")
Orack
just this
.
w8
I'm looking at
Anonymous
https://stackoverflow.com/questions/59071311/retrieving-images-from-django-from-rest-framework This is my issue i cant upload images to rest framework.
Ivan
Hi, gays! Excuse me for my english, i just want to ask a question. Anyone have experience in Laravel? Anything like laravel mix exists in django?
Luis
No need
Ivan
I find for some similarity. For easy transition
Ivan
If you know about mix, you know what i mean. Webpack + vue/react/angular and easy maintainability
Ivan
I saw many articles about how to make friends django and vue/angular/react, but not anything about laravel like ecosystem in django
Z.R.K
I've got a simple Model like this: class Product(models.Model): name = models.CharField(max_length=100) date_of_sale = models.DateTimeField() num_ratings = models.IntegerField() price = models.IntegerField() And to output a day-by-day breakdown of: - How many average sales and average rating there were in a day I made next query: Product.objects.annotate(day=TruncDay('date_of_sale').\ values('day'). \ annotate( avg_stars=('num_ratings'), avg_price=('price') ).order_by('day') Now I need to get the same data but in intervals: - morning 8am-12am - afternoon с 12am-6pm - evening 6pm-23pm Expected result: stats_per_day_part = [ { 'day': '01.01.2019', 'morning': { 'avg_stars': 3.4, 'avg_price': 350 }, 'afternoon': { 'avg_stars': 3.4, 'avg_price': 350 }, 'evening': { 'avg_stars': 3.4, 'avg_price': 350 } }, ... ] Any help would be appreciated. Thanks.
Anonymous
Who know in python clear read only status
Anonymous
And i dont write program in python
Mirco
Raudin
Hello everyone, I am working with a form in a 'CreateView' view, I have the success_url property in the view to redirect me to a ListView when submitting in the form, but it only works in a DeleteView, what do I need to do to make it work? PD: I'm new in django
Anonymous
use method get_absolute_url inside ur models
Anonymous
for eg:- def get_absolute_url(self): return reverse("basic_app:ty")
Raudin
for eg:- def get_absolute_url(self): return reverse("basic_app:ty")
Already try that, do you have any examples that work to see it?
Anonymous
Wait I will dm u
Raudin
Manish
I am using custom authentication class and i have some function on that class and now i want to call those functions from api view class. I have already set authentication_classes=[mycustomauthenticationclass,] in APIView class. I am using DRF. Help is really appreciated 🙂
python developer
Human
Install pillow
Rectified ...the error I found is forget to add request.Files.
Ghorz
Okay
When you click on the image link, did the image display?
Human
When you click on the image link, did the image display?
My problem was image is not showing up in local storage (destination folder)...now it showed up
Bot
How can I find out python version used in Django project?
Bot
error: failed to push some refs to 'heroku' on git push heroku master via cmd
Bot
Bot
Any solution?
Mihail
How can i give access to see some content only for selected users using type of choice in my CharField? It's like {% if user user.is_authenticated %} in HTML
Maksim
User group or permissions
Shikhar
Anyone who has used TimeFeild in models.py
Shikhar
Actually I've created a var in models.py and I want to assign only time to it. What to do
Rajat
can anyone suggest to me how to use sessions in order to get data from an android client? I tried it using socket programming but not work as I wanted.
K
How to get value on which ur clicking from request object??
Shikhar
How to get value on which ur clicking from request object??
Set a name attribute. And then in views.py accept the the value using post method
K
But i m getting None at output
K
I used <a href="something" name="name">
K
In my template
Shikhar
I m using request.GET.get('name')
request.POST["name"]
Bayarkhuu
Import error : cannot import name ? How to solve
Bayarkhuu
?
K
request.POST["name"]
In request information it says no GET, No POST data
Shikhar
In request information it says no GET, No POST data
It's better if you post your image here: https://prnt.sc/
Opeyemi
I have a custom user model, and I am adding a slug field to the model. T problem is I don't know how it should be handled in the user manager. Note: I use signals to create the data for the slug model.py class UserManager(BaseUserManager): def _create_user(self, email, fullname, password, is_staff, is_superuser, **extra_fields): if not email: raise ValueError('Users must have an email address') now = timezone.now() email = self.normalize_email(email) fullname = fullname user = self.model( email=email, fullname=fullname, is_staff=is_staff, is_active=True, is_superuser=is_superuser, last_login=now, date_joined=now, **extra_fields ) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, fullname, password, **extra_fields): return self._create_user(email, fullname, password, False, False, **extra_fields) def create_superuser(self, email, fullname, password, **extra_fields): user=self._create_user(email, fullname, password, True, True, **extra_fields) user.save(using=self._db) return user class User(AbstractBaseUser, PermissionsMixin): username = None email = models.EmailField(max_length=254, unique=True) fullname = models.CharField(max_length=250) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) is_active = models.BooleanField(default=True) last_login = models.DateTimeField(null=True, blank=True) date_joined = models.DateTimeField(auto_now_add=True) slug = models.SlugField(max_length=255, unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['fullname'] objects = UserManager() def __str__(self): return self.email signals.py @receiver(pre_save, sender=settings.AUTH_USER_MODEL) def add_slug_to_user(sender, instance, *args, **kwargs): if instance and not instance.slug: slug = slugify(instance.fullname) random_string = generate_user_string() instance.slug = slug + "-" + random_string the problem is how do I handle the slug field in the BaseUserManager if I am using signals to get it created, the methods I try out I get errors, like TypeError: create_superuser() missing 1 required positional argument: 'slug'
raven
I have a custom user model, and I am adding a slug field to the model. T problem is I don't know how it should be handled in the user manager. Note: I use signals to create the data for the slug model.py class UserManager(BaseUserManager): def _create_user(self, email, fullname, password, is_staff, is_superuser, **extra_fields): if not email: raise ValueError('Users must have an email address') now = timezone.now() email = self.normalize_email(email) fullname = fullname user = self.model( email=email, fullname=fullname, is_staff=is_staff, is_active=True, is_superuser=is_superuser, last_login=now, date_joined=now, **extra_fields ) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, fullname, password, **extra_fields): return self._create_user(email, fullname, password, False, False, **extra_fields) def create_superuser(self, email, fullname, password, **extra_fields): user=self._create_user(email, fullname, password, True, True, **extra_fields) user.save(using=self._db) return user class User(AbstractBaseUser, PermissionsMixin): username = None email = models.EmailField(max_length=254, unique=True) fullname = models.CharField(max_length=250) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) is_active = models.BooleanField(default=True) last_login = models.DateTimeField(null=True, blank=True) date_joined = models.DateTimeField(auto_now_add=True) slug = models.SlugField(max_length=255, unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['fullname'] objects = UserManager() def __str__(self): return self.email signals.py @receiver(pre_save, sender=settings.AUTH_USER_MODEL) def add_slug_to_user(sender, instance, *args, **kwargs): if instance and not instance.slug: slug = slugify(instance.fullname) random_string = generate_user_string() instance.slug = slug + "-" + random_string the problem is how do I handle the slug field in the BaseUserManager if I am using signals to get it created, the methods I try out I get errors, like TypeError: create_superuser() missing 1 required positional argument: 'slug'
better use autoslug package it will do all those for you
raven
set slug to blank True
Opeyemi
set slug to blank True
thanks man, this did the trick
raven
👍
Anonymous
How to add 2 difrent apps url in single page plz help i am new to django Thanks in advance
milo
Hello everybody.. Does anyone knows about django - knockout?
milo
Django-jinja-knockout.readthedocs.io
milo
It seems to be very useful..
milo
Can you - maybe - share your appreciations?
Alex
I have a custom user model, and I am adding a slug field to the model. T problem is I don't know how it should be handled in the user manager. Note: I use signals to create the data for the slug model.py class UserManager(BaseUserManager): def _create_user(self, email, fullname, password, is_staff, is_superuser, **extra_fields): if not email: raise ValueError('Users must have an email address') now = timezone.now() email = self.normalize_email(email) fullname = fullname user = self.model( email=email, fullname=fullname, is_staff=is_staff, is_active=True, is_superuser=is_superuser, last_login=now, date_joined=now, **extra_fields ) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, fullname, password, **extra_fields): return self._create_user(email, fullname, password, False, False, **extra_fields) def create_superuser(self, email, fullname, password, **extra_fields): user=self._create_user(email, fullname, password, True, True, **extra_fields) user.save(using=self._db) return user class User(AbstractBaseUser, PermissionsMixin): username = None email = models.EmailField(max_length=254, unique=True) fullname = models.CharField(max_length=250) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) is_active = models.BooleanField(default=True) last_login = models.DateTimeField(null=True, blank=True) date_joined = models.DateTimeField(auto_now_add=True) slug = models.SlugField(max_length=255, unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['fullname'] objects = UserManager() def __str__(self): return self.email signals.py @receiver(pre_save, sender=settings.AUTH_USER_MODEL) def add_slug_to_user(sender, instance, *args, **kwargs): if instance and not instance.slug: slug = slugify(instance.fullname) random_string = generate_user_string() instance.slug = slug + "-" + random_string the problem is how do I handle the slug field in the BaseUserManager if I am using signals to get it created, the methods I try out I get errors, like TypeError: create_superuser() missing 1 required positional argument: 'slug'
Maybe use pastebin or similar next time (just an advice)
Rounak
I am having a knowledge of html and Css...can I start learning backend directly... Using django
Arturo
no
raven
I am having a knowledge of html and Css...can I start learning backend directly... Using django
you should have basic knowledge of python. It will take you some time to understand how backend works .
.
Hi, How to enable csrf protection in DRF Token authentication?
Shikhar
I'm getting error " no such column: home_information.time " . Home is my app information is my model and time is a variable which is getting value through date timefeild Please see this https://paste.pics/7DAI5
Shikhar
https://paste.pics/7DAS7