Reach the server

2019-07-15 Thread CHENXIN YANG
I created the new Django project on a vagrant virtual box, but I had 
trouble reaching the server at http://127.0.0.1:8000/ after running the 
server.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a75bfed-68f1-45f5-a029-1367674fab2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Create a multitab home page of a blog

2019-07-15 Thread Nicolas Huergo
Hey!

I'm pretty much new to Django, so I cannot figure this out:

I have the home page and the way to post updates in my blog, but I want to 
sort the posts into categories. Like sports, fitness, politics. But I want 
to do it into two lists of multiple tabs, one horizontal and one vertical. 
And I'd like to make the horizontal and vertical tabs combine, so that when 
I click on horizontal tab01 and vertical tab01, e.g., it renders a certain 
view (or category of posts). Does this make any sense? Is it possible with 
Django? If so, how?

Help is much appreciated.

Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2d0684a9-c581-4b31-8009-2b043ed25ba5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ModelForm "error_css_class" not getting applied to ValidationErrors raised in model.clean()

2019-07-15 Thread Jacob Greene
Hello! Has anyone dealt with this before? It seems that my forms don't add 
the CSS class to errors raised in model.clean() or model.clean_fields() 
methods. 

I have a form that looks something like this: 

class HttpsFaxBoxForm(forms.ModelForm):
error_css_class = 'form_error'


class Meta:
model = FaxBox
fields = ('outbound_cid_profile', 'id')



And I run validation in my models(keep the admin page consistent) like this:

class FaxBox(models.Model):

something = fields.CharField(max_length=100)


def clean(self):
if self.something == "shouldn't be here":

raise ValidationError('This should not be here! Please fix!')
super().clean_fields(exclude=None)


But when this exception gets raised, the CSS class isn't applied to it in 
the template. Anyone know of a way to work around this? Thanks for reading!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8cfa5a86-ccaf-47f7-8b10-93fbaaaf4386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Admin autocomplete with diacritic support (transliteration / accent support)

2019-07-15 Thread Alex Scott
Hello,

I'm using the built-in autocomplete for my admin section which I believe 
uses the Select2  package.  In the documentation of 
Select2 , it 
says diacritic-modified letters will be translated into ASCII counterparts 
by default.  They give a nice example there.

But that doesn't seem to be the case in the Django admin.  I type in "bene" 
and it doesn't match bénédictine.

Any help to fix this would be appreciated!

Thanks,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3cd11b9-09d7-4ec0-a99f-590b1be82e42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: UniqueConstraint raises uncaught IntegrityError in Admin

2019-07-15 Thread Michael Barr
Yeah, this one just bit me in the Django Admin as well. According to the 
docs ,

Validation of Constraints
>
> In general constraints are *not* checked during full_clean(), and do not 
> raise ValidationErrors. Rather you’ll get a database integrity error on 
> save(). UniqueConstraints are different in this regard, in that they 
> leverage the existing validate_unique() logic, and thus enable two-stage 
> validation. In addition to IntegrityError on save(), ValidationError is 
> also raised during model validation when the UniqueConstraint is violated.
>

However, it makes no mention of UniqueConstraint instances with conditions 
being ignored. It took me diving into the Django source code to find out 
what was happening. Thankfully, I stumbled upon this here to confirm my 
sanity. :)

On Tuesday, April 9, 2019 at 9:13:19 AM UTC-4, Simon Charette wrote:
>
> No form validation is implemented for UniqueConstraint(condition) yet as 
> that would require
> a non-trivial refactor of how it's performed. It was discussed during the 
> feature development[0].
>
> I'd suggest you override you form or your model's clean() method to 
> perform the validation
> yourself until built-in support is added.
>
> Submitting a new Trac ticket so we don't loose track of the issue would 
> also be appreciated.
>
> Cheers,
> Simon
>
> [0] https://github.com/django/django/pull/10796#discussion_r244216763
>
> Le mardi 9 avril 2019 07:29:53 UTC-4, Ryan Jarvis a écrit :
>>
>> Hey there,
>>
>> I'm trying out the new UniqueConstraint functionality in Django 2.2 and 
>> seem to be misunderstanding something.  When adding a Constraint to the 
>> model I am getting an uncaught IntegrityError in the admin.  
>> I've got the following sample code:
>>
>> *models.py*
>>
>> class Seminar(models.Model):
>> seminar_id = models.CharField(max_length=255, unique=True)
>> members = models.ManyToManyField(User, through='SeminarRole', 
>> related_name="studies")
>>
>> class SeminarRole(models.Model):
>> LEAD = 1  # Only 1 Lead permitted per seminar
>> SUPPORT = 2
>> ROLE_CHOICES = (
>> (LEAD, 'Lead'),
>> (SUPPORT, 'Support'),
>> )
>>
>> user = models.ForeignKey(User, related_name='seminar_roles', 
>> on_delete=models.CASCADE)
>> seminar = models.ForeignKey('seminar', related_name='roles', 
>> on_delete=models.CASCADE)
>>
>> role = models.IntegerField(choices=ROLE_CHOICES)
>>
>> class Meta:
>> constraints = [
>> models.UniqueConstraint(fields=['seminar'], 
>> condition=Q(role=1), name="only_one_lead"),
>> ]
>>
>>
>>
>> For the code above in the Django Admin I can successfully add a 
>> SeminarRole with User1 as the Lead for SeminarA, User2 as the Lead for 
>> SeminarB, and User1 as Support for SeminarB but if I try and add User2 as 
>> another Lead to SeminarA it gives me an Exception.  Should I be seeing the 
>> Django Admin catch this before hand?
>>
>> IntegrityError at /admin/study_management/seminarrole/add/
>> duplicate key value violates unique constraint "only_one_lead"
>> DETAIL:  Key (seminar_id)=(1) already exists.
>>
>>
>> I'm on Django 2.2, Python 3.7 and Postgres 11.2
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e0a79eab-e9d6-46fb-86c3-8f5d97fb3f7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


E-Mail Client Django

2019-07-15 Thread Sebastian Jung
Hello,

i want a full complete E-Mail client like https://www.mailpile.is/ but in 
django. I need only from mailpile a view with template with email 
directories on left side and in rest with a list with date and subject. 
When user click on email then on bottom open detailview from email. 

And i want a template to send a new html e-mail with a html editor like ck 
editor. I need imap, pop3 and smtp with ssl/tls

I don't find on google a simliar project.

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c15693e9-20c3-4b27-b2fb-de082bb9e581%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django admin application for Android

2019-07-15 Thread Ibrahim K
Good work, really appreciated one!!

On Monday, July 15, 2019 at 4:21:58 PM UTC+5:30, Jens-Joris Decorte wrote:
>
> Hello Django developers!
>
> Being both a Django developer and a heavy user of Django applications, I 
> found myself accessing the admin interface of my Django sites quite often 
> via my smartphone when I am on the road.
> I was stoked to see the new responsive admin since Django 2.0, which made 
> this process much smoother.
>
> Lately I've been developing an *Android app* to access your site's admin. 
> It ports the *responsive design to ALL Django versions* and includes even 
> more features to make the experience very mobile friendly.
> I have just released this app on the Google Play Store 
>  so 
> feel free to check it out or to share it with other Django developer / 
> users. Any feedback will also be appreciated!
>
> The app can be found here: 
> https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin
>
> [image: Django-admin-1] 
>  [image: 
> Django-admin-2.jpg] 
> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bdf029d-f8d9-470a-b4b9-69dab007e82c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: integrate vue js with django

2019-07-15 Thread Sam W
*Use Django REST framework for Django  and Vue.axios for vuejs*


*Example: *
https://medium.com/@jrmybrcf/how-to-build-a-project-with-django-vuejs-create-a-rest-api-endpoint-b57374a89661

On Monday, July 15, 2019 at 12:10:48 AM UTC-5, Pradeep Singh wrote:
>
> can anyone tell me how to integrate vue js with django 
>
> thanks in advance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e59602c-c89d-49da-83c9-bdb1c5f66350%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


integrate vue js with django

2019-07-15 Thread Ryan Kite

This article has a working code sample for getting Vue and Django to work, 
NOTE: use the Git repo linked at the very end. 

The code samples in the articles are just for reading.

https://medium.com/quick-code/crud-app-using-vue-js-and-django-516edf4e4217

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba4ff5be-8bfb-4b84-8e56-d548d14032d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SESSION_EXPIRE_AT_BROWSER_CLOSE

2019-07-15 Thread Bill Freeman
Once there was no such thing as a cookie that expired at browser close.
Note that such must be implemented by the user agent (browser), since
that's the only thing that knows if it has been closed.  (And, in fact, if
you want it to be closed if the browser crashes, or if it is hard killed by
the OS, or if the machine crashes, it doesn't get an opportunity to delete
cookies.  Probably this is implemented at start up, when it can toss
anything in the cookie store marked as close at end of browser session.
Cookies in RAM only is another approach, but there can be security exploits
through having cookies push the size of process RAM.)  You would have to
check whether the user agent (as claimed) supports this, since not all
browsers (I'll bet) support the feature, and choose a different mechanism
otherwise.  Probably best to just use that other mechanism.

One approach comes to mind.  Have JavaScript implementing a heart beat
poll, and have the cookie invalidated on the Django side if the last
access, poll or normal, was "too long' ago.  Two issues with involve what
constitutes "too long".  Sometimes people have bad connections, and "too
long" may elapse during their network latency of the moment.  And if "too
long" is too long,  you can easily close and restart the browser before it
elapses.

Another that may or may not be possible in all user agents is to access the
timestamp at which the browser was started and include that with each
request (possibly by having the JavaScript that runs when the page load
modify the cooking to include that timestamp.  Then Django session code
would have to consider a non-matching cookie invalid, but accept that
timestamp when accepting a log in.

This has long been a tough problem.  Further, I'm not sure that you are
doing your users any favors by training them to believe that closing the
browser logs them out.  There will be plenty of sites where this doesn't
work.

On Sun, Jul 14, 2019 at 11:33 AM M. Farhan Zia 
wrote:

> Im facing the same problem, How did you solve this problem?
>
>
> On Sunday, January 22, 2017 at 1:21:04 PM UTC+5, ADEWALE ADISA wrote:
>>
>> Good day;
>> Please i need help on the issues am facing on
>> SESSION_EXPIRE_AT_BROWSER_CLOSE django settings.py. In my setting file i
>> have:
>>
>> SESSION_EXPIRE_AT_BROWSER_CLOSE = True
>>
>> but unfortunately, whenever my users close there browsers and open it
>> again, they are login automatically, which shows that the session did not
>> expire.
>> Am facing this issue on all browers.
>> On chrome, when i went to the settings and manually choose to expire
>> cookies, the  SESSION_EXPIRE_AT_BROWSER_CLOSE worked.
>> In deployed application, i can not be asking my users to be changing
>> cookies setting in their browsers.
>> Please how can i achieve session expire after closing browser
>> irrespective of user browser settings. Or if there is javasctipt snippet i
>> can use to control this.
>>
>> Thanks in advance.
>> soliu - fxSoftlogix
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/add560a7-21ee-4971-98fd-8e8dc66c6b13%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0u-TqspFnsm4XQv4J24db7gvGo4xkQd6tw%2BMVAL_CPJXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 如何解析源码

2019-07-15 Thread Fabio C. Barrionuevo da Luz
https://github.com/django/django


Em seg, 15 de jul de 2019 07:51, xuehao weng 
escreveu:

> 如何解析源码
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/187aaa0c-b08f-4fa7-a4d6-b15e2db3dd18%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPVjvMYm8xn5483kt1eSMhoXNw-7CT%3Ds3oaiDnv%3DiogWOVdG0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


如何解析源码

2019-07-15 Thread xuehao weng
如何解析源码

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/187aaa0c-b08f-4fa7-a4d6-b15e2db3dd18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploying Django app with Channels on a Shared Linux Hosting

2019-07-15 Thread DANIEL URBANO DE LA RUA
Yo have to use daphne to deploy asgi application is all not uwsgi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dcfaff1f-6c3c-4b03-866c-633f45e83707%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploying Django app with Channels on a Shared Linux Hosting

2019-07-15 Thread Fatemeh Ahmadzadeh
Hi friend,
Are you slove this problem?
I have the same problem.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d32d78f4-d4d6-4f1f-a67a-8abd7629fe8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Collapsible elements in admin stopped working with latest release

2019-07-15 Thread Mike Dewhirst
Paul

I have dug a little deeper.I am getting a warning in 2.1 ...

D:\Users\mike\envs\xxct3\lib\site-packages\django\forms\widgets.py:126: 
MediaOrderConflictWarning: Detected duplicate Media files in an opposite 
order:
admin/js/vendor/jquery/jquery.min.js
/tinymce/filebrowser/
  MediaOrderConflictWarning,

... which doesn't prevent collapsible elements collapsing. 

Django 2.2 forms.widgets.merge is merging multiple lists instead of just 
two lists in Django 2.1 so it is possible that the innocuous warning from 
2.1 becomes an unintended elimination of the particular bit of js which 
collapses those elements when javascript files are in the wrong sequence.

I'm guessing the actual problem in 2.2 is likely from collectstatic 
skipping files which already exist. Try deleting all your static files and 
run collectstatic again.

Mike

On Sunday, July 14, 2019 at 10:53:14 AM UTC+10, Mike Dewhirst wrote:
>
> Are you using TinyMCE, filebrowser and Grappelli? 
>
> I had a similar problem as you describe and resorted to 
> django-tinymce4-lite and django-filebrowser-no-grappelli which fixed it 
> for me. 
>
> I haven't done any deep digging so I can't be certain why mine started 
> behaving properly. 
>
> Mike 
>
> On 13/07/2019 3:11 am, Paul Michalski wrote: 
> > 
> > I just upgraded from Django 2.1.3 to 2.2.3, at which point collapsible 
> > elements in the admin interface stopped working. I’m using IE11, and 
> > in the console I see the error “object doesn't support property or 
> > method 'matches'”, with a reference to line 35 of collapse.js in the 
> > admin package. I did some research and I found that IE11 doesn’t 
> > support the “matches” function, so I just modified the admin base 
> > template with a polyfill to get things working on my machine. But the 
> > collapsible elements were working fine with my old version of Django 
> > on IE11, so it looks like a polyfill (or something) was removed in the 
> > most recent Django version. Does anyone know what might have changed? 
> > If something was changed, I think this is a bug – we shouldn’t have to 
> > modify the templates in the admin package to use IE11. 
> > 
> > This is my first post. Thanks for any comments or suggestions. 
> > 
> > 
> > Paul 
> > 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8d34bf59-bcab-4540-a1bd-74794e3a1f71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.