These are chat archives for django/django

5th
Apr 2017
Woody Huang
@huangy10
Apr 05 2017 07:49
@fahad611 just post your question here
Anish Shrestha
@annshress
Apr 05 2017 07:57
implentinting real-time messaging with django-channels (front-end written in React js)
How complex is it going to be?
Fahad Rashid
@peerfahad
Apr 05 2017 08:02
@huangy10 how can i change the commit if its write worng?
Woody Huang
@huangy10
Apr 05 2017 08:13
@fahad611 You means that you have a commit and you want to cancel it?
If so you can try git reset HEAD~1
Punit Grover
@PunitGr
Apr 05 2017 11:04
@annshress I guess there are already examples of this kind of problem. Check Andrew Godwin's example.
Hey all,
So here is my problem. I have my backend serving as rest api using django and frontend as an electron app with reactjs. One can create and update queries. So what i want is whenever a query is added or updated it should be rendered at the same time on my electron app. I'm quite new to django-channels and confused on how to get this thing work. Anyone having any idea about what plugs should i create or something similar?
Woody Huang
@huangy10
Apr 05 2017 12:32
@PunitGr You should try to keep a live connection between your client and server. Maybe you should try tornado or nodejs which is good at hanlding such connect due to their async i/o feature.
@PunitGr non-block I/O
@PunitGr If there is only limited number of clients. you can make the clients keep asking the server for update over and over again.
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 13:59
Hello everyone! I have 3 admin sites, and I'd like to restrict user access to each site, based on the group user they belong too, is this possible?
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 14:56
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 15:37
yeyy it works! :D
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 17:33
class SupervisorSite(AdminSite):
    def has_permission(self, request):
        groups = [group.lower() for code, group in request.user.groups.values_list()]

        return request.user.is_active and request.user.is_staff and (
            "supervisor" in groups or
            "administrator" in groups
        )
JohnCulver
@JohnCulver
Apr 05 2017 17:53

Hi, I have a python question that I hope isn't inappropriate in this channel as it isn't necessarily django specific...
I am trying to create a wheel from a directory called "plugins" that contains some python files and some html files.
My setup.py looks like this:

from setuptools import setup
setup(name='a_wheel',
      version='1.0',
      py_modules=['plugins'],
      )

and there is a folder in the same directory as setup.py called "plugins"

When I run this command to make a wheel, the wheel is pretty much empty...:
python setup.py bdist_wheel sdist
Any ideas why my wheel is empty?

JohnCulver
@JohnCulver
Apr 05 2017 18:10
was able to figure this out, instead of py_modules needed to use package_data and data_files
cs89gr
@cs89gr
Apr 05 2017 18:21
hello can help someone ?i want to multi upload images in django and i have this model .but i dont know how yo write form upload or views_upload.
class MyModel(models.Model):
    user = models.ForeignKey(to=settings.AUTH_USER_MODEL)
    upload = models.FileField(upload_to=some_specific_dir)
Jean Japheth Ezekiel
@iamdejean
Apr 05 2017 18:25
Hello, I am new to programming. Can anyone help please??
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 19:00
@cs89gr use either TabularInline or
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 19:27
class ChoiceInline(admin.StackedInline):
      model = MyModel
      extra = 3
or StackedInline ---^
Is that what you need?
cs89gr
@cs89gr
Apr 05 2017 19:30
i want from html page multi upload not from admin
cs89gr
@cs89gr
Apr 05 2017 21:01
@Ismael-VC what is the extra=3 ? i see that again in your proposal before
Ismael Venegas Castelló
@SalchiPapa
Apr 05 2017 23:46
@cs89gr it states how many new inlines you want to have by default, you can always add more by clicking the +