Thursday, December 28, 2017
Re: Still having trouble with django-filebrowser
>
>
> However, the same treatment fails on my Windows runserver dev
> platform. Brand new virtualenv for Py27 and Py36 still fail to
> show the little browse link on the right-hand end of the Source field.
>
>
> Have you verified that your Windows virtualenv is not including the
> global system Python libraries as well? There may be a conflict at the
> system level outside if your virtualenv. Inspecting the search path
> should reveal where Python is looking.
Definitely. Here is what my "announce.py" called from
train.settings.mike-local shows me every time I launch runserver ...
Train rev: 0.1.0
Settings: train.settings.mike-local
Python: 3.6.3
Django: 1.11.8
Database: localhost:5434
Postgres: 9.5.3
Engine: django.db.backends.postgresql_psycopg2
Cache: django.core.cache.backends.dummy.DummyCache
Email: django.core.mail.backends.smtp.EmailBackend
Site ID: 3 - Development
sys.path: C:\Users\mike\envs\xxct3\train
C:\Users\mike\envs\xxct3\Scripts\python36.zip
C:\python36\DLLs
C:\python36\lib
C:\python36
C:\Users\mike\envs\xxct3
C:\Users\mike\envs\xxct3\lib\site-packages
bleach==2.1.2
certifi==2017.11.5
chardet==3.0.4
Django==1.11.8
django-filebrowser-no-grappelli==3.7.3
django-tinymce4-lite==1.7.0
html5lib==1.0.1
idna==2.6
jsmin==2.2.2
olefile==0.44
Pillow==4.3.0
psycopg2==2.7.3
pytz==2017.3
requests==2.18.4
six==1.11.0
sqlparse==0.2.4
urllib3==1.22
webencodings==0.5.1
SharedTrain Admin = admin@sharedsds.com
BASE_DIR = C:/Users/mike/envs/xxct3/train/train(project root)
SETTINGS_DIR = C:/Users/mike/envs/xxct3/train/train/settings
MEDIA_ROOT = C:/var/www/media/train/ (store
uploaded images)
MEDIA_URL = <website>/media/ (serve uploaded images)
STATIC_ROOT = C:/var/www/static/train/ (collectstatic dest)
STATIC_URL = <website>/static/ (serve css, js etc)
STATICFILES_DIRS# 1 = C:/Users/mike/envs/xxct3/train/static/
TEMPLATE DIRS# 1 = C:/Users/mike/envs/xxct3/train/templates/
Launched: 16:32:56
Performing system checks...
Not Apache
System check identified no issues (0 silenced).
December 29, 2017 - 16:33:20
Django version 1.11.8, using settings 'train.settings.mike-local'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
My next trick will be to compare the rendered html from both sites and
try and analyse the differences.
Cheers
Mike
>
> -James
> --
> 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+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/CA%2Be%2BciXSOEVnBqrsD9_pnkvPxK0nkcSvZgCZOWogZ8VmFQtOoA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXSOEVnBqrsD9_pnkvPxK0nkcSvZgCZOWogZ8VmFQtOoA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> 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+unsubscribe@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/711bf435-3874-5375-15e3-e8de0ee45cc6%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Re: DRF JWT Token with Mobile
On Thursday, December 28, 2017 at 6:22:07 PM UTC+5:30, Krishnasagar Subhedarpage wrote:
Can you elaborate question? Please add some background for it.---Krishnasagar
On Thu, Dec 28, 2017 at 1:40 PM, Mukul Mantosh <mukulma...@gmail.com> wrote:How to get JWT Token in DRF using only mobile number as the parameter instead of email and password..--
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...@googlegroups.com .
To post to this group, send email to django...@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/1b3ae8bb- .2039-4aa9-8a9f-2c4ddb2ffc55% 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+unsubscribe@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/b0d5e227-7488-4c86-b757-681c287a1558%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Still having trouble with django-filebrowser
However, the same treatment fails on my Windows runserver dev platform. Brand new virtualenv for Py27 and Py36 still fail to show the little browse link on the right-hand end of the Source field.
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+unsubscribe@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/CA%2Be%2BciXSOEVnBqrsD9_pnkvPxK0nkcSvZgCZOWogZ8VmFQtOoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
RE: Possible bug Django 2.0 CreateView generic CBV
The problem is in your HTML template.
Your form tag really only has to be this (the action attribute should be a URL; otherwise, it assumes the current URL):
<form method="POST">
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Steven Meyer
Sent: Thursday, December 28, 2017 7:44 PM
To: Django users
Subject: Possible bug Django 2.0 CreateView generic CBV
I hope I've got the right group this time. I originally posted it on Django core membership but Tim Graham emailed me to say it was the wrong group.
I am very new to Django - been at it for five weeks. Not sure whether this is a bug or my own stupidity.
Here is my model in an app called gcbv (for generic class-based view)
from django.db import models
from core.models import TimeStampModel
from django.urls import reverse
# Create your models here.
class Vehicle(TimeStampModel):
maker = models.CharField(max_length=100)
model_year = models.IntegerField()
vehicle_type = models.CharField(max_length=100)
slug = models.SlugField(max_length=100, unique=True)
vehicle_model = models.CharField(max_length=100)
website = models.URLField(max_length=100, blank=True)
email = models.EmailField(max_length=100, blank=True)
notes = models.TextField(blank=True, default='')
def __str__(self):
x = self.maker + ' ' + self.vehicle_model
return x
And here are the URLs
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
from . import views
from django.urls import reverse
#from django.views.generic.base import TemplateView
app_name = 'gcbv'
urlpatterns = [
path('sub1/', views.SubView.as_view(), name='sub1'),
path('vehicle_list/', views.VehicleListView.as_view(),
name = 'vehicle_list'),
path('vehicle/<str:slug>/',
views.VehicleDetailView.as_view(),
name='vehicle_detail'),
path('vehicle/create', views.VehicleCreateView.as_view(),
name='vehicle_create'),
path('', views.IndexTemplateView.as_view(), name='index'),
]
And here is the relevant view
class VehicleCreateView(CreateView):
model = Vehicle
fields = ['maker', 'model_year', 'vehicle_type', 'slug',
'vehicle_model', 'website', 'email', 'notes']
labels = {'maker':'Maker', 'model_year':'Year',
'vehicle_type':'Type', 'vehicle_model':'Model',
'website':'Website', 'email':'Email', 'notes':'Notes'}
Here is the template:
{% extends "core/base.html" %}
{% block body_block %}
<h1>Vehicle Create for GCBV</h1>
<form action="POST" action="">
{% csrf_token %}
{{ form.as_p }}
<button name="submit" class="btn btn-primary">Submit</button>
</form>
<h1>End Vehicle Create for GCBV</h1>
{% endblock %}
I've attached screenshots of:
--The rendered form template
--What happens after I click submit
It looks as if the data is not being saved to the database.
If I add the same data from admin everything works fine. I've attached another screenshot showing that VehicleDetailView has found the relevant template and rendered the information.
Any help would be greatly appreciated.
NB: This all worked fine when I was using function views and regex instead of path.
--
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+unsubscribe@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/5aa037bb-25d5-442d-b1a6-b1bbc558dead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Possible bug Django 2.0 CreateView generic CBV
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+unsubscribe@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/5aa037bb-25d5-442d-b1a6-b1bbc558dead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: Still having trouble with django-filebrowser
16.04 Apache 2.2 vhost Python 2.7 mod-wsgi
The problem was related to not uninstalling django-tinymce before
installing django-tinymce4-lite and similarly with
django-filebrowser-no-grappelli.
So it looks like your guess was correct. There must have been a
javascript mashup in there somewhere.
However, the same treatment fails on my Windows runserver dev platform.
Brand new virtualenv for Py27 and Py36 still fail to show the little
browse link on the right-hand end of the Source field.
Additionally I *just* noticed there is a Filebrowser app displaying in
the Admin on the staging server but not on the dev site! I'll have to
look into that and report back. If I can get to the bottom of that it
will be the resolution. My CI system guarantees the same source
everywhere so there must be something I'm doing somewhere which is
causing it.
Thank you very much for responding. I reckon it sometimes makes the
difference between giving up (well, working around) and persisting.
Cheers
Mike
On 18/12/2017 11:26 PM, Mike Dewhirst wrote:
> On 18/12/2017 8:23 PM, Etienne Robillard wrote:
>> Looks likes this is using javascript. What does the javascript
>> console says? Is the markup of the page valid HTML?
>
> I don't have IE. I can't see a Javascript console with either Chrome
> or Firefox. What should I look for specifically?
>
> How can I test for valid html? View source and inspect it manually?
>
> Which I just did and it looks ok.
>
> Thanks for sticking with this. I appreciate it.
>
> It is bedtime here.
>
> Cheers
>
> Mike
>
>>
>> HTH
>>
>> Etienne
>>
>> Le 2017-12-17 à 22:06, Mike Dewhirst a écrit :
>>> This time with version 3.9.2 having climbed a little higher into the
>>> branches ...
>>>
>>> C:\Users\mike\envs\xxct3\lib\site-packages\django_filebrowser-3.9.2-py3.6.egg\filebrowser\sites.py:12:
>>> RemovedInDjango20Warning: Importing from django.core.urlresolvers is
>>> deprecated in favor of django.urls.
>>> from django.core.urlresolvers import reverse, get_urlconf,
>>> get_resolver
>>> C:\Users\mike\envs\xxct3\train\train\urls.py:113:
>>> RemovedInDjango20Warning: Passing a 3-tuple to
>>> django.conf.urls.include() is deprecated. Pass a 2-tuple containing
>>> the list of patterns and app_name, and provide the namespace
>>> argument to include() instead.
>>> url(r'^admin/filebrowser/', include(site.urls)),
>>>
>>> But no change.
>>>
>>> I have also deleted my project/templates/admin folder and still no
>>> change from the screenshot sent earlier - which I did not see so
>>> I'll attach a new one to this email.
>>>
>>> Cheers
>>>
>>> Mike
>>>
>>>
>>> On 18/12/2017 11:35 AM, Mike Dewhirst wrote:
>>>> On 18/12/2017 9:28 AM, Etienne Robillard wrote:
>>>>>
>>>>> Hi Mike,
>>>>>
>>>>> What Django version are you using? Is this happening with Python 2
>>>>> or 3?
>>>>>
>>>>
>>>> Sorry Etienne. Should have mentioned that.
>>>>
>>>> Python 3.6 but it also needs to work with Py27
>>>>
>>>> Django 1.11.8
>>>>
>>>>> Have you tried to turn on Python warnings?
>>>>>
>>>>
>>>> C:\Users\mike\envs\xxct3\lib\site-packages\filebrowser\sites.py:12:
>>>> RemovedInDjango20Warning: Importing from django.core.urlresolvers
>>>> is deprecated in favor of django.urls.
>>>> from django.core.urlresolvers import reverse, get_urlconf,
>>>> get_resolver
>>>> C:\Users\mike\envs\xxct3\train\train\urls.py:113:
>>>> RemovedInDjango20Warning: Passing a 3-tuple to
>>>> django.conf.urls.include() is deprecated. Pass a 2-tuple containing
>>>> the list of patterns and app_name, and provide the namespace
>>>> argument to include() instead.
>>>> url(r'^admin/filebrowser/', include(site.urls)),
>>>>
>>>>> Have you tried to use the development verion of django-filebrowser?
>>>>>
>>>>
>>>> Yes. Installed from trunk. Same outcome. Here is a screenshot
>>>>
>>>>
>>>>
>>>>> HTH
>>>>>
>>>>> Etienne
>>>>>
>>>>>
>>>>> Le 2017-12-17 à 15:48, Mike Dewhirst a écrit :
>>>>>> An update. I adjusted settings ...
>>>>>>
>>>>>> FILEBROWSER_DIRECTORY = 'uploads/'
>>>>>> FILEBROWSER_VERSIONS_BASEDIR = '_versions/'
>>>>>>
>>>>>> .. and to match these dirs ...
>>>>>>
>>>>>> 'media/_versions/'
>>>>>> 'media/uploads/'
>>>>>>
>>>>>> Still won't show me an upload or browse button in the insert
>>>>>> image dialog.
>>>>>>
>>>>>> I also uninstalled and reinstalled to no effect.
>>>>>>
>>>>>> Thanks for any help
>>>>>>
>>>>>> Mike
>>>>>>
>>>>>> On Saturday, December 16, 2017 at 7:04:34 PM UTC+11, Mike
>>>>>> Dewhirst wrote:
>>>>>>
>>>>>> I have tried both django-filebrowser and
>>>>>> django-filebrowser-no-grappelli
>>>>>> with django-tinymce4-lite
>>>>>>
>>>>>> The TinyMCE part is working fine in the Admin and trying to
>>>>>> insert an
>>>>>> image in the text is trying to work and if I pasted in a url it
>>>>>> would
>>>>>> probably insert the image it points to.
>>>>>>
>>>>>> The problem is there is no browse button in the image-insert
>>>>>> dialog box.
>>>>>>
>>>>>> The Admin ImageField [Browse] button works fine.
>>>>>>
>>>>>> In settings ...
>>>>>> FILEBROWSER_DIRECTORY = '/'
>>>>>>
>>>>>> url(r'^admin/filebrowser/', include(site.urls)),
>>>>>> url(r'^tinymce/', include('tinymce.urls')),
>>>>>> url(r'^admin/', admin.site.urls),
>>>>>>
>>>>>> Any hints appreciated ..
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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+unsubscribe@googlegroups.com
>>>>>> <mailto:django-users+unsubscribe@googlegroups.com>.
>>>>>> To post to this group, send email to
>>>>>> django-users@googlegroups.com
>>>>>> <mailto: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/f9a34b92-9005-4cda-a4a6-40efc00dcf28%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/f9a34b92-9005-4cda-a4a6-40efc00dcf28%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>> --
>>>>> Etienne Robillard
>>>>> tkadm30@yandex.com
>>>>> https://www.isotopesoftware.ca/
>>>>> --
>>>>> 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+unsubscribe@googlegroups.com
>>>>> <mailto:django-users+unsubscribe@googlegroups.com>.
>>>>> To post to this group, send email to django-users@googlegroups.com
>>>>> <mailto: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/0f1b5957-e66b-4c8a-57ca-85d7848406d6%40yandex.com
>>>>> <https://groups.google.com/d/msgid/django-users/0f1b5957-e66b-4c8a-57ca-85d7848406d6%40yandex.com?utm_medium=email&utm_source=footer>.
>>>>>
>>>>> 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+unsubscribe@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/e9882b5a-4995-7c10-43ba-99e332f475fe%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Re: How to parse json and display it in CBV.
--On Dec 27, 2017 1:02 PM, "tango ward" <tangoward15@gmail.com> wrote:Follow up question. Apologies for the continuation.I tried integrating the API from OpenDOTA https://api.opendota.com/api/heroes .my code:import requestsimport jsonurl = requests.get('https://api.opendota.com/api/heroes ')res = url.json()when I typed in 'res' in my terminal, it returns a List of dictionaries. Now, is it possible to turn this list to a dictionary? Apologies for the confusion, I am confuse as well.The terms you are looking for are serialization (converting Python objects to JSON) and deserialization (converting JSON to Python objects).If you're using requests, and you can successfully run the .json() method, then you successfully converted the JSON to a native Python structure.In this case, you are requesting a list of heroes, so you received a list back. You'll need to find the hero you want in the list using the standard methods of working with Python lists, access that element, and then you'll have access to the dict for that hero.There is probably a way to get a single dict for a specific hero from the API, but I'm not familiar with their API structure. You'll need to revert to their API documentation to determine the correct URL structure.-James
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+unsubscribe@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/CA%2Be% .2BciUVLzj8%2BeZvwJo_tPGLy7- f33Nqwv4yf8v8GA3HdwBNEA% 40mail.gmail.com
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+unsubscribe@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/CAA6wQLLsH%3D9Vs4ph%3Dh_2Lg1nW3eppgqEn29haJXOLo0YSPPEdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



