Re: Any django reusable app for outdoor & indoor location, GPS tracking?

2018-05-04 Thread 'Federico Capoano' via Django users
Hey everyone,

I forgot to follow up on this thread.

django-loci  now provides 
abstract/base classes for models, admin, channels so other developers can 
use this reusable app as a kind of library.

There's ample room for improving this new reusable app but nonetheless I 
hope it will be a useful addition to the django ecosystem.

Best regards
Federico


On Tuesday, November 21, 2017 at 3:34:16 PM UTC+1, Federico Capoano wrote:
>
> Hi everyone,
>
> I'd like to provide an update on this topic.
>
> First of all, I think my initial question was not 100% clear.
>
> For indoor location and GPS tracking I meant the following:
>
> Indoor location: being able to specify the location of an object in 
> buildings, having their floorplan(s).
> GPS tracking: being able to track objects that move around, in the case of 
> OpenWISP  these objects will be most likely be 
> network/radio/wifi devices.
>
> In the end I didn't find any reusable app so I started working on a new 
> app which I named django-loci . 
> It's not released yet but it kinda works, I have shown a prototype of this 
> work during this presentation (I'm linking the exact second in which I show 
> it): https://www.youtube.com/watch?v=WgVduiZzuA0 (the recording was 
> slightly disturbed so bear with it while you wait for the floorplan demo to 
> show up.
>
> Like the other OpenWISP 2 base modules, I will soon provide abstract base 
> models, base views and other classes/functions that third party apps can 
> import in their project and extend.
> We have done this for django-x509 
>  and is going quite well, since 
> other developers who don't use OpenWISP are using django-x509 in their 
> project, reporting bugs and sending patches.
>
> I'll send another announcement when we hit the 0.1 release of django-loci, 
> hopefully it will be useful to other people and/or we'll be able to collect 
> useful feedback and/or suggestions.
>
> Federico
>
> PS: if you are curious to know more about the modular architecture of 
> OpenWISP 2, there's a presentation which has a good level of detail 
> https://www.slideshare.net/FedericoCapoano/applying-the-unix-philosophy-to-django-projects-a-report-from-the-real-world
>
>
> On Tuesday, September 26, 2017 at 12:13:30 PM UTC+2, Federico Capoano 
> wrote:
>>
>> Hi everyone,
>>
>> before building my own reusable app all over again, I wanted to ask here 
>> if there is any reusable django app that does indoor location and or GPS 
>> tracking.
>> I'm not looking for something full featured, but rather a starting point 
>> to which I can contribute to.
>>
>> Best regards
>> Federico Capoano
>>
>

-- 
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/ad3fc1ca-f377-4536-8475-7a02774c5bc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
You need to add your model to the app's admin.py file.

As an example:
https://docs.djangoproject.com/en/2.0/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin

El vie., 4 may. 2018 a las 8:32, Harish Soni ()
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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/CAHXg%3DN0GgESWXjOhJHjvdMnT0UGOY5usryLGGc_nNujWJOoPfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Harish Soni
I've added to app's admin.py then only mentioned in mail.

On Fri 4 May, 2018, 2:58 PM Fidel Leon,  wrote:

> You need to add your model to the app's admin.py file.
>
> As an example:
> https://docs.djangoproject.com/en/2.0/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin
>
> El vie., 4 may. 2018 a las 8:32, Harish Soni ()
> escribió:
>
>> Hi All,
>> whenever I create a new model(table) and migrate. I can see it is
>> available in mysql but its not showing in admin. I have to delete my db and
>> make migrations of all the tables again to make that table show in admin.
>>  any help would be appreciate.
>>
>> Regards
>> Harish Soni Swarnkar
>>
>> --
>> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Fidel Leon
> fi...@flm.cat
> Phone: +34 622 26 44 92
>
> --
> 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/CAHXg%3DN0GgESWXjOhJHjvdMnT0UGOY5usryLGGc_nNujWJOoPfw%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/CAMOFmonAV8UZAsJnYsTT8JN9FU8pysUm%2B15kzvjoPG%3D6wiUpqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site and Model

2018-05-04 Thread Fidel Leon
May we see your admin.py?

El vie., 4 may. 2018 a las 8:32, Harish Soni ()
escribió:

> Hi All,
> whenever I create a new model(table) and migrate. I can see it is
> available in mysql but its not showing in admin. I have to delete my db and
> make migrations of all the tables again to make that table show in admin.
>  any help would be appreciate.
>
> Regards
> Harish Soni Swarnkar
>
> --
> 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/CAMOFmommxT%3DCLjabwVo0T5ubJ-z8GhN8xwbCXMFcEHXpjR4DEw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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/CAHXg%3DN2Le%2BO1jRE7ELTOs1UTy75azLAoe6oqXeLzMFTrF2bC4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Crazy Idea: OOP for "Hyperlink"

2018-05-04 Thread guettli
In my use case there is no model involved.

I have a django url-mapping (regex to view) not model.

Regards,
  Thomas Güttler

Am Montag, 30. April 2018 15:55:44 UTC+2 schrieb TonyF-UK:
>
> What is wrong with a special type of Field - which is a URL, but also 
> have augmented data items which are stored on the model? 
>
> As far as I know - there is no rule that states that each 'Field' on a 
> model has to have one and only one field in the database. Even if you 
> have one and only one field in the database, you could capture augmented 
> information about the URL, and store that as a blob field on the model. 
>
> The Custom field would also implement the right methods to turn the 
> field into html, or even a form. 
>
> All possible - the question is how much effort is needed to implement 
> and test this custom Field. 
>
> -- 
> -- 
> Anthony Flury 
> email : *anthon...@btinternet.com * 
> Twitter : *@TonyFlury * 
>
> On 30/04/18 08:24, guettli wrote: 
> > 
> > 
> > Am Donnerstag, 26. April 2018 15:54:31 UTC+2 schrieb Matthew Pava: 
> > 
> > I’ve been thinking about your idea, and I wonder if there could 
> > instead be some kind of widget for URL objects (or views). 
> > 
> > 
> > A widget ... Let me think about it. A widget is a libray, is source 
> code. 
> > The code needs some data to operate on. 
> > Where should the data come from? Where should I store the data? 
> > What kind of data/input does the widget need? 
> > 
> > I have no clue 
> > -- 
> > 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/fd48e249-9d57-43f5-87e4-09bed383af62%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/fd48e249-9d57-43f5-87e4-09bed383af62%40googlegroups.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+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/415bfc09-172e-4346-a42e-664a1d691e17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


importError

2018-05-04 Thread gkfka5968
I run 'python manage.py runserver'.
but this message appear.

Traceback (most recent call last):
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\autoreload.py",
 
l
ine 228, in wrapper
fn(*args, **kwargs)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\command
s\runserver.py", line 124, in inner_run
self.check(display_num_errors=True)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
", line 359, in check
include_deployment_checks=include_deployment_checks,
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
", line 346, in _run_checks
return checks.run_checks(**kwargs)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\registry.py
", line 81, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
 
l
ine 16, in check_url_config
return check_resolver(resolver)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
 
l
ine 26, in check_resolver
return check_method()
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
 
lin
e 254, in check
for pattern in self.url_patterns:
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
 
l
ine 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
 
lin
e 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
 
l
ine 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
 
lin
e 398, in urlconf_module
return import_module(self.urlconf_name)
  File "c:\Python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
  File "C:\Users\gkfka\PycharmProjects\django\cafe\mysite\mysite\urls.py", 
line 17, in 
from django.urls import include, path
ImportError: cannot import name include

-- 
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/e9634a2e-8970-4f14-bb2b-1275ce305fad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I got error when working on "Writing your first Django app, part 5" of tutorial

2018-05-04 Thread truongtronghai
When I run below command
>>> response = client.get('/')
I got error "module 'django.conf.global_settings' has no attribute 
'ROOT_URLCONF'"

Please give me advice to solve it. 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/899aa22c-8aee-40ea-8f4a-ef653e48ee07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django-channels request depending Middleware

2018-05-04 Thread Marius Räsener
Hey everybody,

We are using a Middleware to inject postgresql schemas into queries based on a 
subdomain. You can have a look how it‘s done here:
https://github.com/systori/systori/blob/dev/systori/apps/company/middleware.py

Now, for channels I‘ve noticed that there is no usual request, right?
So, if I‘m connecting a WS it doesn‘t hit the Middleware. 
Are there any guides or docs available or any recommendations how to solve this 
properly for channels?

Thx,
Marius

-- 
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/6534824B-4E3B-4E39-8DA0-DF807A84CADC%40mehr-handwerk.de.
For more options, visit https://groups.google.com/d/optout.


Re: importError

2018-05-04 Thread Fidel Leon
>From the look of things, it seems:
-You're following the Django v2.0 tutorial.
-You have installed a Django v1 version.

This is an example with Django v2:

>>> import django
>>> django.get_version()
*'2.0.5' *
>>> from django.urls import include, path
>>>
*[No error]*

And this is an example with Django v1.11

>>> from django import get_version
>>> get_version()
*'1.11.13' *
>>> from django.urls import include, urls
Traceback (most recent call last):
 File "", line 1, in 
*ImportError: cannot import name 'include'*
>>>

So either you upgrade your Django package, or you follow your Django
version's tutorial :)


El vie., 4 may. 2018 a las 15:12,  escribió:

> I run 'python manage.py runserver'.
> but this message appear.
>
> Traceback (most recent call last):
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\autoreload.py",
> l
> ine 228, in wrapper
> fn(*args, **kwargs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\command
> s\runserver.py", line 124, in inner_run
> self.check(display_num_errors=True)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
> ", line 359, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\management\base.py
> ", line 346, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\registry.py
> ", line 81, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
> l
> ine 16, in check_url_config
> return check_resolver(resolver)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\core\checks\urls.py",
> l
> ine 26, in check_resolver
> return check_method()
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 254, in check
> for pattern in self.url_patterns:
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
> l
> ine 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 405, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\utils\functional.py",
> l
> ine 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "C:\Users\gkfka\PycharmProjects\django\venv\lib\site-packages\django\urls\resolvers.py",
> lin
> e 398, in urlconf_module
> return import_module(self.urlconf_name)
>   File "c:\Python27\Lib\importlib\__init__.py", line 37, in import_module
> __import__(name)
>   File "C:\Users\gkfka\PycharmProjects\django\cafe\mysite\mysite\urls.py",
> line 17, in 
> from django.urls import include, path
> ImportError: cannot import name include
>
> --
> 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/e9634a2e-8970-4f14-bb2b-1275ce305fad%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Fidel Leon
fi...@flm.cat
Phone: +34 622 26 44 92

-- 
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/CAHXg%3DN1JFHZBryqHtMM0DbBf5Q9XyG6h%2BAJmFAmH7UbWU8jPjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-04 Thread gibsonal2026
okay

On Thursday, May 3, 2018 at 10:37:47 AM UTC-5, Avitab Ayan Sarmah wrote:
>
> *mysite/urls.py:*
>
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path('', include('polls.urls')),
> path('admin/', admin.site.urls),
> ]
>
> *polls/templates/polls/index.html*:
>
> {% if latest_question_list %}
>   
>   {% for question in latest_question_list %}
> {{
> question.question_text }}
>   {% endfor %}
>   
> {% else %}
>   No polls are available.
> {% endif %}
>
> *polls/urls.py*:
>
> from django.urls import path
>
> from . import views
>
> urlpatterns = [
> # ex: /polls/
> path('', views.index, name='index'),
> # ex: /polls/5/
> path('/', views.detail, name='detail'),
> #ex: /polls/5/results/
> path('/results/', views.results, name='results'),
> #ex: /polls/5/vote/
> path('int:question_id>/vote/', views.vote, name='vote'),
> ]
>
> *polls/views.py*:
>
> from django.http import HttpResponse
> from django.template import loader
>
> from . models import Question
>
> def index(request):
> return HttpResponse("Hello, world.You're at the polls index.")
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> output = ', '.join([q.question_text for q in latest_question_list])
> return HttpResponse(output)
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> template = loader.get_template('polls/index.html')
> context = {
> 'latest_question_list': latest_question_list,
> }
> return HttpResponse(template.render(context, request))
> def detail(request, question_id):
> return HttpResponse("You're looking at question %s." % question_id)
>
> def results(request, question_id):
> response = "You're looking at the results of question %s."
> return HttpResponse(response % question_id)
>
> def vote(request, question_id):
> return HttpResponse("You're voting on question %s." % question_id)
>
>
> i've attached the command prompt below.Please check,your help would be 
> very helpfull
>

-- 
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/38e201a2-49f4-480a-b9f2-fa49f5622c22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-04 Thread Andrew Wrigley
 

Hi all,


I'm trying to dump a database fixture, and load it again to run tests. When 
I run `python manage.py test`, I get:

 

> IntegrityError: Problem installing fixtures: insert or update on table 
> "publisher_journaldupextid" violates foreign key constraint 
> "publisher_journaldup_journal_id_67a6a414_fk_publisher"
> DETAIL:  Key (journal_id)=(153) is not present in table 
> "publisher_journal".

 

On further inspection this is because 
django.core.serializers.sort_dependencies, which I'm using to create the 
fixture, is sorting models in the wrong order. Looking at the source of 
sort_dependencies, the only constraints on the ordering of models relate to 
natural keys. I'm not using natural keys, but my database has foreign key 
constraints so order of loading is still important.

 

Am I missing something about how to save and load models without violating 
FK constraints?

-- 
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/aa34a69f-e20c-4d4f-92a0-e44429e62c0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


sphinx is showing the django base views instead of my own views.py

2018-05-04 Thread Anthony Petrillo


The view being shown when using Sphinx on a Django site is: 




The beginning of my views.py is:


import os

from django.shortcuts import render, redirect 

from django.urls import reverse 

from django.http import HttpResponse, HttpResponseRedirect 

from django.utils import timezone

from . forms import PlayForm, RollForm, checkBoard, BossForm

from random import randint 

from . templatetags.playExtras import translateDice 

from .models import Board, Winner, Boss


def getFirstFolder(req):

""" return the string between first two / - this is a hack, find out 
how to do it with the object """

r = req.split("'")

loc = r[1].find('/',1)

x = r[1][1:loc]

return(x)


def loadBoard(request,context,location=''):

''' Load the board from the database into context. Add a hyperlink for 
available squares.


:param context: context for template

:type context: dictionary


:param location: Comma seperated string of available locations or empty 
string so no links included.

:type location: str


:return: 'not on the board' or 'all taken' or comma seperated string of 
location options such as 'A0,B0'

:rtype: str

'''

req = request.__str__()

I was getting errors if I didn't show Sphinx where the Python was located. 
The path additions I made in the Sphinx's conf.py are:

ourPaths = [
'/game/',
'/game/game',
'/game/play',
'/game/play/templatetags'
]
for p in ourPaths:
abspath = os.path.abspath('.')  + p
print('path..',abspath)
sys.path.insert(0, abspath)
# Need to point to where the Django is on this system. FIND OUT HOW TO MAKE 
THIS RELATIVE
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages')
sys.path.insert(0,'/home/ajp/Downloads/env/lib/python3.5/site-packages/django')


The views.rst file I'm using: 

views module
==

.. automodule:: views
:members:
:undoc-members:
:show-inheritance:

I searched for days but I'm afraid I do not know the right terms search for 
to find the answer. I posted on stackoverflow for a couple weeks and no 
responses at all. 

I'm okay with the other code showing up, but I'd need to see my code in the 
manual as well.

Thank you for any help you can give. 

-- 
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/e53d3f68-b008-4d4a-a9bd-74d1af57337c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Query Regarding Django Signals

2018-05-04 Thread Nipun Arora
Hello Community 

I was puzzled by the fact that if django signals are not asynchronous why 
do we use them as in when ever i want some trigger on post_save can't  i 
simply write that particular trigger in the same function that handles the 
request for saving a new object in django views..?
as in :


def handlerequest(Request):
save instance to db 
   Do the work i would do in the method handling the signal post_save


-- 
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/5b64f4e4-afa2-485b-96a9-825b3c93b95e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Query Regarding Django Signals

2018-05-04 Thread Matthew Pava
The advantage with the signals is that you can put all that code in one place.  
You may have different views that are saving the same model, and it isn’t DRY 
to have to put that same code in multiple locations.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Nipun Arora
Sent: Friday, May 4, 2018 10:37 AM
To: Django users
Subject: Query Regarding Django Signals

Hello Community

I was puzzled by the fact that if django signals are not asynchronous why do we 
use them as in when ever i want some trigger on post_save can't  i simply write 
that particular trigger in the same function that handles the request for 
saving a new object in django views..?
as in :

def handlerequest(Request):
save instance to db
   Do the work i would do in the method handling the signal post_save


--
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/5b64f4e4-afa2-485b-96a9-825b3c93b95e%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/10a41cd61e124053ae127bc226ce72fc%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels request depending Middleware

2018-05-04 Thread Andrew Godwin
That's correct - Django middleware only runs on HTTP request objects, and
so doesn't work in a WebSocket context. The recommended alternative is to
write ASGI middleware for this purpose.

Unfortunately, there is not good documentation on this yet, but you can see
a bit about it here, in the authentication docs:
http://channels.readthedocs.io/en/latest/topics/authentication.html#custom-authentication

Andrew

On Fri, May 4, 2018 at 6:12 AM Marius Räsener  wrote:

> Hey everybody,
>
> We are using a Middleware to inject postgresql schemas into queries based
> on a subdomain. You can have a look how it‘s done here:
>
> https://github.com/systori/systori/blob/dev/systori/apps/company/middleware.py
>
> Now, for channels I‘ve noticed that there is no usual request, right?
> So, if I‘m connecting a WS it doesn‘t hit the Middleware.
> Are there any guides or docs available or any recommendations how to solve
> this properly for channels?
>
> Thx,
> Marius
>
> --
> 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/6534824B-4E3B-4E39-8DA0-DF807A84CADC%40mehr-handwerk.de
> 
> .
> 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/CAFwN1upH03QzfeycVhHwJ2Bqks96y26npDNZa%2B5etkUWPn0mPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I got error when working on "Writing your first Django app, part 5" of tutorial

2018-05-04 Thread brzrkr
It seems you need to point your Django project to your urls.py file. See: 
https://docs.djangoproject.com/en/2.0/ref/settings/#root-urlconf
This should point to your urls.py file, the file containing the 
`urlpatterns` variable, which is a list of `path()` statements.
For example if your urls.py file is in `/myapp/urls.py`, in your 
settings.py you should write: `ROOT_URLCONF = myapp.urls`.

On Friday, 4 May 2018 15:13:08 UTC+2, truongtronghai wrote:
>
> When I run below command
> >>> response = client.get('/')
> I got error "module 'django.conf.global_settings' has no attribute 
> 'ROOT_URLCONF'"
>
> Please give me advice to solve it. 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/22414d59-c59b-4528-8bdb-9bccf351e5b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom User model writes email in username column and vice-versa (postgresql)

2018-05-04 Thread brzrkr
Hi guys, I'm new here.

I customised the User model of my project by inheriting from 
AbstractBaseUser, I've also made a custom Manager through BaseUserManager 
and added an auth backend to login through email instead of username.
The reason I did this is to let users register and login using their email 
but still have a username, that doesn't have to be unique (they're 
differentiated through a discriminator not unlike the one Discord uses, if 
you know it, like brzrkr#0001 and brzrkr#2342 may exist at the same time 
and both be known as brzrkr).

The problem is, when I create a user with `manage.py createsuperuser`, the 
database saves the email in the "username" field and the username in the 
"email" field, even though I set all overridden variables to the correct 
fields (see below for code).

NOTE: I have also posted a question about this on stackoverflow but it's 
been ignored for some days now, so I've looked for a place where people may 
be more familiar with Django in particular. Here is the link to 
it: https://stackoverflow.com/q/50104202/8599834

Now here's the *code of the User model* not including irrelevant methods:
class User(AbstractBaseUser, PermissionsMixin):
"""Override of the Django class to handle user authentication."""
# ==Identification==
# To allow for multiple users with the same username, users are 
publicly identified with username#identifier.
# Internally, only the couple username + identifier must be unique, but 
either can be duplicate on their own.
username = models.CharField(max_length=150, db_column="user_username")
# The identifier is stored as a string of digits including trailing 
zeroes.
# It is assigned at creation and modification of a user's nick using 
the first value that doesn't conflict.
identifier = models.CharField(max_length=settings.IDENTIFIER_DIGITS)

email = models.EmailField(unique=True, db_column="user_email")

objects = UserManagerOverride()  # Override the default manager to 
customise user creation.

is_superuser = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)

USERNAME_FIELD = "email"
EMAIL_FIELD = "email"
REQUIRED_FIELDS = ["username"]

class Meta:
unique_together = ("username", "identifier")

This is the *Manager*. This is mostly identical to what BaseUserManager 
does except for some quirks. I haven't included the generate_identifier 
method because it's not relevant:
class UserManagerOverride(BaseUserManager):
"""Override of the default Django user manager."""
def _create_user(self, email, username, password, **extra_fields):
"""Override the parent function to create a user and save it in the 
database."""
if not email:
raise ValueError('An email is required.')

# Prepare the data to be stored into the database.
email = self.normalize_email(email)
username = self.model.normalize_username(username)
identifier = self.generate_identifier(username)

# Make the user instance.
user = self.model(username=username, email=email, 
identifier=identifier, **extra_fields)

# Add the password after encrypting.
user.set_password(password)

try:
# Save to database.
user.save(using=self._db)
except Exception:
# If there was an error, scratch the user row to preserve 
integrity with User and UserData primary keys.
user.delete()
raise
else:
# Create a UserData record for this user.
# Thanks to the try-else, we only do this if the code raised no 
exceptions.
UserData.objects.create(user=user)

return user

def create_user(self, email, username, password=None, **extra_fields):
"""Override parent function to create a regular user account."""
extra_fields.setdefault('is_staff', False)
extra_fields.setdefault('is_superuser', False)
return self._create_user(email, username, password, **extra_fields)

def create_superuser(self, email, username, password, **extra_fields):
"""Override parent function to create a superuser account."""
extra_fields.setdefault('is_staff', True)
extra_fields.setdefault('is_superuser', True)

if extra_fields.get('is_staff') is not True:
raise ValueError('Superuser must have is_staff=True.')
if extra_fields.get('is_superuser') is not True:
raise ValueError('Superuser must have is_superuser=True.')

return self._create_user(username, email, password, **extra_fields)

And finally the *auth backend*, although this should only come into play 
when trying to log in, so it isn't involved in the problem (at least for 
now):
class EmailBackend(ModelBackend):
"""Allow authentication using email instead of username."""
def authenticate(self, username=

Django-admin problem

2018-05-04 Thread Mikko
Hi,

I'm trying to follow the tutorial, but I got this problem at the very 
beginning when I tried ''django-admin startproject mysite'':

django-admin : The term 'django-admin' is not recognized as the name of a 
cmdlet, function, script file, or operable pr
ogram. Check the spelling of the name, or if a path was included, verify 
that the path is correct and try again.
At line:1 char:1
+ django-admin startproject mysite
+ 
+ CategoryInfo  : ObjectNotFound: (django-admin:String) [], 
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Could someone help me to overcome this?


-- 
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/28096273-fd67-4084-ba8a-f4e3c75d5916%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin problem

2018-05-04 Thread Jani Tiainen
Hi,

By the looks of error you're running windows.

By default scripts are not in PATH so you need to type something like
c:\python36\scripts\django-admin.py

Or you should use virtualenv (or pipenv) which would set path correctly.

pe 4. toukokuuta 2018 klo 19.51 Mikko 
kirjoitti:

> Hi,
>
> I'm trying to follow the tutorial, but I got this problem at the very
> beginning when I tried ''django-admin startproject mysite'':
>
> django-admin : The term 'django-admin' is not recognized as the name of a
> cmdlet, function, script file, or operable pr
> ogram. Check the spelling of the name, or if a path was included, verify
> that the path is correct and try again.
> At line:1 char:1
> + django-admin startproject mysite
> + 
> + CategoryInfo  : ObjectNotFound: (django-admin:String) [],
> CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> Could someone help me to overcome this?
>
>
> --
> 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/28096273-fd67-4084-ba8a-f4e3c75d5916%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/CAHn91odAtLj7Xc%3DChc0f7yLZ-HY7hiM3%3DaNSRxhY1MQd_qbREw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Django-admin problem

2018-05-04 Thread Matthew Pava
And you’re using PowerShell instead of the command prompt.  I typically just 
work in the command prompt.  With PowerShell, you may have to be more explicit 
in your path, such as using “.\django-admin startproject mysite”

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Jani Tiainen
Sent: Friday, May 4, 2018 1:26 PM
To: django-users@googlegroups.com
Subject: Re: Django-admin problem

Hi,

By the looks of error you're running windows.

By default scripts are not in PATH so you need to type something like 
c:\python36\scripts\django-admin.py

Or you should use virtualenv (or pipenv) which would set path correctly.

pe 4. toukokuuta 2018 klo 19.51 Mikko 
mailto:mikkovillemero...@gmail.com>> kirjoitti:
Hi,

I'm trying to follow the tutorial, but I got this problem at the very beginning 
when I tried ''django-admin startproject mysite'':

django-admin : The term 'django-admin' is not recognized as the name of a 
cmdlet, function, script file, or operable pr
ogram. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ django-admin startproject mysite
+ 
+ CategoryInfo  : ObjectNotFound: (django-admin:String) [], 
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Could someone help me to overcome this?


--
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/28096273-fd67-4084-ba8a-f4e3c75d5916%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/CAHn91odAtLj7Xc%3DChc0f7yLZ-HY7hiM3%3DaNSRxhY1MQd_qbREw%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/9a713a6d5e6a43e987a422e33be385e1%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Trigger password reset

2018-05-04 Thread Álmos Kovács
Hi Everyone,

I got stucked with triggering password reset in my custom view. I want to
trigger it in different places but I want to use the OOTB souliton. I've
found that I can import and use
from django.contrib.auth.forms import PasswordResetForm
and
from django.contrib.auth.views import password_reset
but it didn't send any email. I wasn't able to see any emails using the
console email debugger option in the settings.

I've tried these ways:
def reset_password(request):
reset_form = PasswordResetForm({'email': request.POST.get('email')})
assert reset_form.is_valid()
reset_form.save(
request=request,
use_https=request.is_secure(),
subject_template_name='registration/account_creation_subject.txt',
email_template_name='registration/account_creation_email.html',
)
return HttpResponse("the given mail: " + request.POST.get('email'))

def reset_password (request):
return password_reset(request,
post_reset_redirect="/admin/accounts/list/")

Could anyone help me to triggering password reset from my views?

Thanks in advance,
Álmos

-- 
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/CADFq4vXJ6Fq4Mf0j0QcCO-H%3DHoTd16w4TSkF8AUronVOgBVvNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin problem

2018-05-04 Thread Mikko Meronen
Thank you for your help.

I also found a video that helped me with PowerShell (just if someone else
has the same problem): https://www.youtube.com/watch?v=3TqO5FfhV28


2018-05-04 21:27 GMT+03:00 Matthew Pava :

> And you’re using PowerShell instead of the command prompt.  I typically
> just work in the command prompt.  With PowerShell, you may have to be more
> explicit in your path, such as using “.\django-admin startproject mysite”
>
>
>
> *From:* django-users@googlegroups.com [mailto:django-users@
> googlegroups.com] *On Behalf Of *Jani Tiainen
> *Sent:* Friday, May 4, 2018 1:26 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Django-admin problem
>
>
>
> Hi,
>
>
>
> By the looks of error you're running windows.
>
>
>
> By default scripts are not in PATH so you need to type something like
> c:\python36\scripts\django-admin.py
>
>
>
> Or you should use virtualenv (or pipenv) which would set path correctly.
>
>
>
> pe 4. toukokuuta 2018 klo 19.51 Mikko 
> kirjoitti:
>
> Hi,
>
>
>
> I'm trying to follow the tutorial, but I got this problem at the very
> beginning when I tried ''django-admin startproject mysite'':
>
>
>
> django-admin : The term 'django-admin' is not recognized as the name of a
> cmdlet, function, script file, or operable pr
>
> ogram. Check the spelling of the name, or if a path was included, verify
> that the path is correct and try again.
>
> At line:1 char:1
>
> + django-admin startproject mysite
>
> + 
>
> + CategoryInfo  : ObjectNotFound: (django-admin:String) [],
> CommandNotFoundException
>
> + FullyQualifiedErrorId : CommandNotFoundException
>
>
>
> Could someone help me to overcome this?
>
>
>
>
>
> --
> 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/28096273-fd67-4084-ba8a-f4e3c75d5916%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/CAHn91odAtLj7Xc%3DChc0f7yLZ-
> HY7hiM3%3DaNSRxhY1MQd_qbREw%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/9a713a6d5e6a43e987a422e33be385e1%40ISS1.ISS.LOCAL
> 
> .
>
> 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/CAGD0jjKsJpsWW58FYwK1LgPBdLWL48MLEqv55ZkQDvb2aguXRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query Regarding Django Signals

2018-05-04 Thread Jani Tiainen
Hi,

Signals are also good for decoupling things.

For example you want to do some post save action for third party models.

4.5.2018 19.10 "Nipun Arora"  kirjoitti:

Hello Community

I was puzzled by the fact that if django signals are not asynchronous why
do we use them as in when ever i want some trigger on post_save can't  i
simply write that particular trigger in the same function that handles the
request for saving a new object in django views..?
as in :


def handlerequest(Request):
save instance to db
   Do the work i would do in the method handling the signal post_save


-- 
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/5b64f4e4-afa2-485b-96a9-825b3c93b95e%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/CAHn91odCSN%3D1bUa46fckK4ositA38TpiuO30cQEsx%2B-pqZPqvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query Regarding Django Signals

2018-05-04 Thread jacob duyon
You can also just write a Celery task to do your async stuff and trigger it
from signals.py

On Fri, May 4, 2018 at 4:13 PM, Jani Tiainen  wrote:

> Hi,
>
> Signals are also good for decoupling things.
>
> For example you want to do some post save action for third party models.
>
> 4.5.2018 19.10 "Nipun Arora"  kirjoitti:
>
> Hello Community
>
> I was puzzled by the fact that if django signals are not asynchronous why
> do we use them as in when ever i want some trigger on post_save can't  i
> simply write that particular trigger in the same function that handles the
> request for saving a new object in django views..?
> as in :
>
>
> def handlerequest(Request):
> save instance to db
>Do the work i would do in the method handling the signal post_save
>
>
> --
> 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/5b64f4e4-afa2-485b-96a9-825b3c93b95e%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/CAHn91odCSN%3D1bUa46fckK4ositA38TpiuO30cQE
> sx%2B-pqZPqvg%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/CAJsZ3R5H%2BHjO9uOEYfsPXV1p6TmE9cvDgtq8ayMyVkc-xbDEqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin problem

2018-05-04 Thread Kamal Kumar Bharadwaj
Hi all,

Thanks for al your help. My error was i was missing a / in
websites/urls.py  in urlpatterns(music).

On Sat, May 5, 2018, 1:19 AM Mikko Meronen 
wrote:

> Thank you for your help.
>
> I also found a video that helped me with PowerShell (just if someone else
> has the same problem): https://www.youtube.com/watch?v=3TqO5FfhV28
>
>
> 2018-05-04 21:27 GMT+03:00 Matthew Pava :
>
>> And you’re using PowerShell instead of the command prompt.  I typically
>> just work in the command prompt.  With PowerShell, you may have to be more
>> explicit in your path, such as using “.\django-admin startproject mysite”
>>
>>
>>
>> *From:* django-users@googlegroups.com [mailto:
>> django-users@googlegroups.com] *On Behalf Of *Jani Tiainen
>> *Sent:* Friday, May 4, 2018 1:26 PM
>> *To:* django-users@googlegroups.com
>> *Subject:* Re: Django-admin problem
>>
>>
>>
>> Hi,
>>
>>
>>
>> By the looks of error you're running windows.
>>
>>
>>
>> By default scripts are not in PATH so you need to type something like
>> c:\python36\scripts\django-admin.py
>>
>>
>>
>> Or you should use virtualenv (or pipenv) which would set path correctly.
>>
>>
>>
>> pe 4. toukokuuta 2018 klo 19.51 Mikko 
>> kirjoitti:
>>
>> Hi,
>>
>>
>>
>> I'm trying to follow the tutorial, but I got this problem at the very
>> beginning when I tried ''django-admin startproject mysite'':
>>
>>
>>
>> django-admin : The term 'django-admin' is not recognized as the name of a
>> cmdlet, function, script file, or operable pr
>>
>> ogram. Check the spelling of the name, or if a path was included, verify
>> that the path is correct and try again.
>>
>> At line:1 char:1
>>
>> + django-admin startproject mysite
>>
>> + 
>>
>> + CategoryInfo  : ObjectNotFound: (django-admin:String) [],
>> CommandNotFoundException
>>
>> + FullyQualifiedErrorId : CommandNotFoundException
>>
>>
>>
>> Could someone help me to overcome this?
>>
>>
>>
>>
>>
>> --
>> 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/28096273-fd67-4084-ba8a-f4e3c75d5916%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/CAHn91odAtLj7Xc%3DChc0f7yLZ-HY7hiM3%3DaNSRxhY1MQd_qbREw%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/9a713a6d5e6a43e987a422e33be385e1%40ISS1.ISS.LOCAL
>> 
>> .
>>
>> 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/CAGD0jjKsJpsWW58FYwK1LgPBdLWL48MLEqv55ZkQDvb2aguXRQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subsc

Re: Error running Django tutorial

2018-05-04 Thread Elorm Koku
You don't have anything like music/index in your urls.py file yet you
are putting it in your request.

On Fri, 4 May 2018, 21:48 Kamal Kumar Bharadwaj, <
bharadwaj.kamal3...@gmail.com> wrote:

> Hi Guys,
>
> I am facing trouble while running the tutorial for Django. I have attached
> the error details and the complete code. I am using python 3.x, django
> 2.0.x with anaconda distribution on python. Please help me asap.
>
>
> Thanks in advance!
>
>
> Regards,
>
> Kamal Kumar Bharadwaj
>
>
>
> On Thursday, 16 March 2017 21:22:12 UTC+5:30, Thomas Pittman wrote:
>>
>> I'm not sure why, but it stopped the error and send to import it. I'm
>> using 3.6?
>>
>> On Mar 16, 2017 11:45 AM, "Vijay Khemlani"  wrote:
>>
>>> Why is there a backslash in
>>>
>>> from django.conf.urls import polls\
>>>
>>> ?
>>>
>>> On 3/16/17, Camilo Torres  wrote:
>>> > Hi.
>>> >
>>> > You may have a strange, non-visible character in your file just before
>>> the
>>> > line giving error.
>>> >
>>> > --
>>> > 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/f9e098eb-2362-4cc1-bc41-0b5a03f64172%40googlegroups.com
>>> .
>>> > For more options, visit https://groups.google.com/d/optout.
>>> >
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/aZQoPBeHDPs/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/CALn3ei2hsX-YPbrf-47E5vfyR-So88UVGHGWGt06br1Jaiqf%3DA%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/de3b1465-be3b-4144-9bf3-62543a3a91fc%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/CAG%2BabP9sa1KjsAukjVj66epFWtga9BtCBooEAWgbuZVHJBcWRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query Regarding Django Signals

2018-05-04 Thread Nipun Arora
okay thanks people..!

On Friday, May 4, 2018 at 9:40:12 PM UTC+5:30, Nipun Arora wrote:
>
> Hello Community 
>
> I was puzzled by the fact that if django signals are not asynchronous why 
> do we use them as in when ever i want some trigger on post_save can't  i 
> simply write that particular trigger in the same function that handles the 
> request for saving a new object in django views..?
> as in :
>
>
> def handlerequest(Request):
> save instance to db 
>Do the work i would do in the method handling the signal post_save
>
>
>

-- 
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/83734488-12d6-4bfa-9e6f-b2b12556eff9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.