Re: from django.urls import include , path ImportError: cannot import name include

2018-12-05 Thread رهام صادقی
Hi,
note that path is only works on django with version > 2.0
for more information about path check following link:
https://docs.djangoproject.com/en/2.1/ref/urls/

‫‪Dheeraj Kumar‬‏ <‪talk...@gmail.com‬‏> در تاریخ چهارشنبه ۵ دسامبر ۲۰۱۸
ساعت ۱۱:۳۳ نوشت:‬

> It won't work.
> now i changed here is and working fine..
>
> from django.contrib import admin
> from django.conf.urls import url, include
>
> urlpatterns = [
> url (r'^boadts/', include ('boadts.urls')),
> url (r'^admin/',admin.site.urls),
> ]
>
> and in apps
>
> from django.conf.urls import url
> from .import views
>
> urlpatterns = [
> url (r'^$', views.home , name = 'home'),
> ]
>
>
> On Tue, 4 Dec 2018 at 22:01, Harryxon Ndegwa 
> wrote:
>
>> use  django.urls import path instead to import path
>>
>> #%£&
>>
>> On Tue, 4 Dec 2018 7:06 pm Dheeraj Kumar >
>>> thanks to respond me but still having an issue.
>>>
>>> from django.contrib import admin
>>> from django.conf.urls import include, path
>>>
>>> urlpatterns = [
>>> path('boadts/', include ('boadts.urls')),
>>> path('admin/',admin.site.urls),
>>> ]
>>>  File "/home/myproject/myproject/myproject/urls.py", line 2, in 
>>> from django.conf.urls import include, path
>>> ImportError: cannot import name path
>>>
>>> please tell.
>>>
>>> On Tue, 4 Dec 2018 at 19:40, C. Kirby  wrote:
>>>
 from django.conf.urls import include


 you are missing conf

 On Tuesday, December 4, 2018 at 8:21:39 AM UTC-5, tal...@gmail.com
 wrote:
>
> plz advise...
>
 --
 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/f2a4a58b-2c9b-4710-8801-e24e9fdf1b45%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/CANwUEV8cExZZKFPJX7VLOwAxn5COVa2P6v4qjRpqY%3Di2e%3DCy-A%40mail.gmail.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/CAPqDb9NwUqQgnUVyovqhMu%3DB7gX9P0vhzhnakOkQgu0D6B%2Bz3Q%40mail.gmail.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/CANwUEV-eBdB80DiZ16QSSU69nsUHqMj7C%3Drr1eBp0u4%3DGpgOdg%40mail.gmail.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 

Re: Need help

2018-11-23 Thread رهام صادقی
Hi,
you can use request.user and check for this if exists.
If so you can redirect this user to another page or in your template do not
show any thing or pop up some errors.

‫<‪a...@codism.io‬‏> در تاریخ جمعه ۲۳ نوامبر ۲۰۱۸ ساعت ۲۰:۴۹ نوشت:‬

> If suppose a user is logged in to the system, and then the user goes to
> the url and go to register page using the url for ex. localhost/register.
> We don,t want this to happen. We don't want the user to go to the register
> page when he is already logged in. How can we resolve this issue? Please
> help
>
> --
> 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/93e2d87e-83e1-4656-8dab-153dfb41e5e9%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/CAJjGCEMu3oGMiwgo3MzmkFWNH1BzwiP69eH%3DEGa47mMtf9NMgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create event or trigger when user are created.

2018-11-23 Thread رهام صادقی
Hi,
You can use django signals with post_save decorators with your model as
receiver.
so every time a user created, your model will send a signal to your desired
function.

‫‪Elton Laice‬‏ <‪eltonlaice.map...@gmail.com‬‏> در تاریخ جمعه ۲۳ نوامبر
۲۰۱۸ ساعت ۲۰:۴۹ نوشت:‬

> hi guys.
>
> How to create event or trigger when user are created.
>
> thku
>
> --
> 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/CAGoRa9c9UqocvDSoaFi0K9kCnTDoS8ZMRKwDmFHvvQhLcga7uA%40mail.gmail.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/CAJjGCEPv4gkBAWhvgfEPWaPphR_sy1gzU79g%2Bg59ukTyG_RWsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py runserver

2018-11-21 Thread رهام صادقی
Hi,
use the following command and see if it works...
./manage.py runserver

‫‪Ayser shuhaib‬‏ <‪embedded.mana...@gmail.com‬‏> در تاریخ سه‌شنبه ۲۰
نوامبر ۲۰۱۸ ساعت ۲۲:۳۴ نوشت:‬

> What is the message that you get when you run Python manage.py runserver
>
> On Tue, 20 Nov 2018 at 20:58, Mohamed Hashi 
> wrote:
>
>> i wrote pip install virtualenv
>> and installed
>> buy when i do all the steps to start django web
>> and i came for python manage.py runserver isnt work
>> so and help bro
>>
>> ‫في الجمعة، 16 نوفمبر 2018 في 12:53 ص تمت كتابة ما يلي بواسطة ‪Mamadou
>> Harouna Diallo‬‏ <‪dev.haro...@gmail.com‬‏>:‬
>>
>>> Are you active your virtuel env if you are use it ?
>>> Or verify if you are in the folder where manage.py is ?
>>>
>>> Le jeu. 15 nov. 2018 18:14,  a écrit :
>>>
 python manage.py runserver isnt running with me








































































 --
 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/430cec4b-0301-44af-9654-a03eafec4fd5%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/CAO73PDqCX0Tghqz0nY-3p3wfZogRnt06HLN4AoE5zosp6efLQw%40mail.gmail.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/CAOiYw3tYEJy%3Dz9Yg0FG6R7%2B5VAcYAe9PcV_zS1YqPss%2BnxMqeA%40mail.gmail.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/CAE0AZGJ4uEvZv_Q-DK_c1UUZ7juFupP1MVA%2BZQ9rELKb4Ntm7g%40mail.gmail.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/CAJjGCEML7YXGPjL2qwZff4Czfg5ZKm2%2Bym87XV6DwpC8z070eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file URL missing project name

2018-11-21 Thread رهام صادقی
Hi,
add these two lines to your settings.py file

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

after that in your base urls.py (a file along with settings.py)
add the following url:

from django.conf.urls.static import static
from django.conf import settings

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATICFILES_DIRS)


‫‪Jeff Williams‬‏ <‪jeff99willi...@gmail.com‬‏> در تاریخ چهارشنبه ۲۱ نوامبر
۲۰۱۸ ساعت ۴:۳۸ نوشت:‬

> Hey Akash,
> I did figure out the enctype="multipart/form-data" issue (I had that for a
> while but figured it out).  My files are loading.they just aren't
> displaying.
>
> I just loaded an image using the Admin interface as you suggested (I
> hadn't thought of trying that) and the load is working.  The URL and path
> are still (relatively) the same:
> http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg
> D:\DjangoStuff\familyrecipies\media\documents\reciper_rK1KS3j.jpg
>
> Still getting this when I try to display.
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/media/documents/reciper_rK1KS3j.jpg
>
> Using the URLconf defined in familyrecipies.urls, Django tried these URL
> patterns, in this order:
>
>1. admin/
>2. oldgrub/
>3.
>4. accounts/
>
> The current path, media/documents/reciper_rK1KS3j.jpg, didn't match any
> of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> I think I mentioned before that I took another picture-upload project,
> built it, and made it work (which it did).
> When I took the relevant parts into my own appit stopped working :-(.
>
> On Tue, Nov 20, 2018 at 3:06 AM Akash Purandare 
> wrote:
>
>> Hey Jeff
>>
>> It is completely alright to try until we find a solution to this.
>> I quote from the Django Documentation:
>> Note that request.FILES
>> 
>>  will
>> only contain data if the request method was POST and the  that
>> posted the request has the attribute enctype="multipart/form-data".
>> Otherwise, request.FILES will be empty.
>>
>> Can you ensure that the particular requirements are fulfilled?
>>
>> Also, I would like to ask you to try to upload a file from the Django
>> admin panel and tell me if it is working. If not, can you send me the URL
>> and the uploaded path of the Admin panel uploaded file?
>>
>> Regards
>> Akash Purandare
>>
>> On Sunday, November 18, 2018 at 8:48:04 PM UTC+5:30, Jeff Williams wrote:
>>
>>> Hi All,
>>> I'm new to django, so sorry if this is a newbie issue.
>>>
>>> I've managed to upload an ImageFieldbut when I try to display it in
>>> my template using object.pic.url...the URL I'm getting back is missing my
>>> project name from the URL and the pic is not loading.
>>>
>>> Specifically I'm getting
>>> http://127.0.0.1:8000/media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>  back.and
>>> I need
>>>
>>> http://127.0.0.1:8000/*oldgrub*
>>> /media/media/56288852934__75FACD12-1711-4655-96D5-716198FE10B7.JPG
>>>
>>> back to have it work.
>>>
>>> What am I missing?  I've poured over my configs.
>>> Jeff
>>>
>> --
>> 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/7a1672c8-0f53-41f3-88c0-e3d7a70e7ae3%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/CAMgbqCdBfiKTUS38XtwsmZ1ETp6cJ04G8CyiFPne6rOfbc2oog%40mail.gmail.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