Re: Best way to run a shell script, using input value from Django?

2019-01-02 Thread Alex Heyden
So, a lot of this doesn't have much to do with Django, but I'm not sure how
familiar you are with web server best practices in general, so apologies if
some of this is remedial for you.

If something takes two minutes to finish, you don't want it being handled
on the request handler itself. Split the job off into a separate worker,
then return *something* to the user. Ideally, that something will allow the
user to continue polling for job updates.

Sounds simple, but the details can be obnoxious. First, you have to figure
out how to track the job. Personally, I prefer to not have to watch a
worker directly. I'd rather watch the results come through. For example, if
your script takes two minutes because it's updating a few thousand items
somewhere, I'd rather watch the items change by OS mtime or auto_now on a
model or whatever makes sense in your context. That means less complexity
in my workers and less complexity in my database. You might not be so
lucky. If one user can kick off a dozen or so of these jobs, and they only
do one thing each, you're probably going to have to track Celery workers
individually by sending to the user a job identifier and storing them in
your database with a foreign key out to your User model. Regardless of how
you decide to do it, the job of the initial request handler is to take care
of this piece of the puzzle: how am I going to track this, kick off the
job, send the tracking information to the user.

The script itself is probably pretty easy. A Celery worker using subprocess
from the standard library will be sufficient, with maybe a little bit
watching stdout to figure out how far along the job is if you need to. Have
the worker write its progress to the database row associated with the job,
or use celery-progress if you'd rather use someone else's implementation of
that idea.

In your UI, you'll want some sort of AJAX loop so the user can watch the
job go. This is usually pretty simple too: just an endpoint that queries
the job's status as recorded in the database and returns it without fanfare.

You probably don't want to automatically delete the database entry for the
job once its done, because you don't know if the user was there to see the
end of it. Save that for a periodic task or a response to the user
acknowledging the end of the job run.

On Wed, Jan 2, 2019 at 4:01 PM Chris Robinson  wrote:

>
> Hello,
>
> I'm going to attempt to generalize my question to make this easier to
> answer.
>
> Lets say I have a simple terminal based shell script (e.g.
> multiply_by_two) that takes a number argument, then multiplies that number
> by 2, and returns the result into a result.txt file.
>
> I would enter something like this:
> multiply_by_two -n 6
>
> The -n flag asks what number I would like to multiply by 2. The result of
> this would be a result.txt, containing the number 12 inside.
>
>
> What I would like to do is develop a simple Djano application that
> contains a text field allowing me to input the number 6, then click
> "Submit."
>
> This job will start on the server by running my custom multiply_by_two
> application with my input parameter (6), but when the job is finished and
> the result.txt is available, the browser will automatically download the
> file.
>
> To make this a tad bit more complex, lets say that the job takes 2 minutes
> to run. What would be the best way to monitor the job? Maybe I accidentally
> close the window.
>
> Not looking for anyone to solve this, I'm just new to Django and want to
> know if someone can give me any pointers on where to start. Are there any
> apps existing that will help me not need to write everything from scratch,
> especially if 'monitoring' is needed? Would Celery be ideal for this?
>
> Thanks for any input!
>
> Regards,
> Chris
>
> --
> 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/7da4b068-ac58-4c26-a0bc-ed4925f8a4f9%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 

Re: Setting up environment variable

2019-01-02 Thread Jason
you need to add `DJANGO_SETTINGS_MODULE as an environment variable when 
setting your run configuration  

[image: Screen Shot 2019-01-02 at 9.05.01 PM.png]

-- 
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/cb9371ea-11d2-4fab-b343-5f366f0e1371%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Are distance lookups available for MySQL or not?

2019-01-02 Thread Jason
https://mariadb.com/kb/en/library/mysqlmariadb-spatial-support-matrix/ seems 
to be a good resource for mariadb gis functions, and as you can see, 
there's no listing for dwithin.  so while there might be support for mysql, 
it probably doesn't extend to mariadb

-- 
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/73795fd3-572b-471b-974b-c9a5e43b3681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


No module named context_processors

2019-01-02 Thread Larry Martell
I am having an odd interment problem. I have an app which is deployed
at 30 different sites. At one site only, and only intermittently, user
will get the error 'No module named context_processors'.

It may happen on a page that was previously accessed with no error and
upon refreshing the same page it will come up fine. It will not occur
for months, then happen a few times in one day.

The app is deployed with nginx and uwsgi.

Here is a typical traceback:

Internal Server Error: /
Traceback (most recent call last):
  File 
"/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py",
line 35, in inner
response = get_response(request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py",
line 158, in _get_response
response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py",
line 156, in _get_response
response = response.render()
  File "/usr/local/lib/python3.5/dist-packages/django/template/response.py",
line 106, in render
self.content = self.rendered_content
  File "/usr/local/lib/python3.5/dist-packages/django/template/response.py",
line 83, in rendered_content
content = template.render(context, self._request)
  File 
"/usr/local/lib/python3.5/dist-packages/django/template/backends/django.py",
line 61, in render
return self.template.render(context)
  File "/usr/local/lib/python3.5/dist-packages/django/template/base.py",
line 173, in render
with context.bind_template(self):
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
  File "/usr/local/lib/python3.5/dist-packages/django/template/context.py",
line 246, in bind_template
processors = (template.engine.template_context_processors +
  File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py",
line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.5/dist-packages/django/template/engine.py",
line 85, in template_context_processors
return tuple(import_string(path) for path in context_processors)
  File "/usr/local/lib/python3.5/dist-packages/django/template/engine.py",
line 85, in 
return tuple(import_string(path) for path in context_processors)
  File "/usr/local/lib/python3.5/dist-packages/django/utils/module_loading.py",
line 17, in import_string
module = import_module(module_path)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 986, in _gcd_import
  File "", line 969, in _find_and_load
  File "", line 956, in _find_and_load_unlocked
ImportError: No module named 'ui.context_processors'

That file does exist and is readable:

-rw-rw-r-- 1 ubuntu ubuntu 1059 May  2  2018 ui/context_processors.py

And here is my TEMPLATES setting:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'ui/templates'),
os.path.join(BASE_DIR, 'app/dse/templates'),
os.path.join(BASE_DIR, 'core/reports/templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'context_processors.config',
'ui.context_processors.navigation',
'core.appmngr.context_processor',
],
},
},
]

As I said it's intermittent. Anyone have any ideas on what it could be
and/or how to debug it?

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


Best way to run a shell script, using input value from Django?

2019-01-02 Thread Chris Robinson

Hello, 

I'm going to attempt to generalize my question to make this easier to 
answer. 

Lets say I have a simple terminal based shell script (e.g. multiply_by_two) 
that takes a number argument, then multiplies that number by 2, and returns 
the result into a result.txt file. 

I would enter something like this:
multiply_by_two -n 6

The -n flag asks what number I would like to multiply by 2. The result of 
this would be a result.txt, containing the number 12 inside. 


What I would like to do is develop a simple Djano application that contains 
a text field allowing me to input the number 6, then click "Submit."

This job will start on the server by running my custom multiply_by_two 
application with my input parameter (6), but when the job is finished and 
the result.txt is available, the browser will automatically download the 
file. 

To make this a tad bit more complex, lets say that the job takes 2 minutes 
to run. What would be the best way to monitor the job? Maybe I accidentally 
close the window.

Not looking for anyone to solve this, I'm just new to Django and want to 
know if someone can give me any pointers on where to start. Are there any 
apps existing that will help me not need to write everything from scratch, 
especially if 'monitoring' is needed? Would Celery be ideal for this?

Thanks for any input!

Regards,
Chris

-- 
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/7da4b068-ac58-4c26-a0bc-ed4925f8a4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best way to submit application cmd, then download a resulting file?

2019-01-02 Thread Chris Robinson
Hello, 

I'm going to attempt to generalize my question to make this easier to 
answer. 

Lets say I have a simple terminal based application (e.g. multiply_by_two) 
that takes a number argument, then multiplies that number by 2, and returns 
the result into a result.txt file. 

I would enter something like this:
multiply_by_two -n 6

The -n flag asks what number I would like to multiply by 2. The result of 
this would be a result.txt, containing the number 12 inside. 


What I would like to do is develop a simple Djano application that contains 
a text field allowing me to input the number 6, then click "Submit."

This job will start on the server by running my custom multiply_by_two 
application with my input parameter (6), but when the job is finished and 
the result.txt is available, the browser will automatically download the 
file. 

To make this a tad bit more complex, lets say that the job takes 2 minutes 
to run. What would be the best way to monitor the job? Maybe I accidentally 
close the window.

Not looking for anyone to solve this, I'm just new to Django and want to 
know if someone can give me any pointers on where to start. Are there any 
apps existing that will help me not need to write everything from scratch, 
especially if 'monitoring' is needed? Would Celery be ideal for this?

Thanks for any input!

Regards,
Chris

-- 
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/6ba9ac84-366c-4c91-b068-3ecc65c27a9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Are distance lookups available for MySQL or not?

2019-01-02 Thread Clara Daia
I wrote the query myself in case the library was messing it up and got the
same error:

self.assertEqual(MyModel.objects.filter(
geopositionfield__dwithin=(
Point(-25.427855, -49.279644),
0.00028321143293561684)
).count(), 1)


Em qua, 2 de jan de 2019 às 16:33, Clara Daia 
escreveu:

> Hello, everybody
>
> I am using Django 2.1 with MariaDB 10.3.
> I have been trying to get the 'dwithin' lookup to work on a PointField,
> but I keep getting the following error:
>
>   ...
>   File
> "/usr/local/lib/python3.6/site-packages/django/contrib/gis/db/models/lookups.py"
> , line 74, in get_rhs_op
> return connection.ops.gis_operators[self.lookup_name]
> KeyError: 'dwithin'
>
> (To be more precise, I am using this filter backend from a library
> ,
> which generates the lookup for me.)
>
> Looking at the docs, I get conflicting info:
>
> * this section
> 
>  says "Availability:
> PostGIS, Oracle, SpatiaLite, PGRaster (Native)", implying 'not available on
> MySQL'
> * this other section
> 
>  says
> MySQL support was added on Django 2.0
>
> I could switch to PostgreSQL as a last resort, but maybe I'm just
> forgetting some configuration? Are the distance lookups available for MySQL
> or not?
>
> Best regards,
>
> Clara
>
> --
> 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/e1452b84-a33f-4121-a329-1aa03f818bf0%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/CAMpbhxxozn_UcHa5b%2B6GXKkC04XK%2Bnr9ZCFfLZEzqXW5t5U3Vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Are distance lookups available for MySQL or not?

2019-01-02 Thread Clara Daia
Hello, everybody

I am using Django 2.1 with MariaDB 10.3.
I have been trying to get the 'dwithin' lookup to work on a PointField, but 
I keep getting the following error:

  ...
  File 
"/usr/local/lib/python3.6/site-packages/django/contrib/gis/db/models/lookups.py"
, line 74, in get_rhs_op
return connection.ops.gis_operators[self.lookup_name]
KeyError: 'dwithin'

(To be more precise, I am using this filter backend from a library 
,
 
which generates the lookup for me.)

Looking at the docs, I get conflicting info:

* this section 

 says "Availability: 
PostGIS, Oracle, SpatiaLite, PGRaster (Native)", implying 'not available on 
MySQL'
* this other section 

 says 
MySQL support was added on Django 2.0

I could switch to PostgreSQL as a last resort, but maybe I'm just 
forgetting some configuration? Are the distance lookups available for MySQL 
or not?

Best regards,

Clara

-- 
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/e1452b84-a33f-4121-a329-1aa03f818bf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Installing and using django registration – backends

2019-01-02 Thread Yuval Bachrach
Installing and using django registration – backends

The package is installed (pip) and migration is clean. Next steps at the
documents: Adding to urls at urlpatterns but I get error messages (details
below). So I am stacked at the very beginning. As a Django beginner, I
would be happy to get some help.

The issues are with “backaends” that exists on the file system (with the
required content) but Django can’t find it



*Details:*

Ø  The urls added:

urlpatterns = [

url(r'^accounts/',
include('django_registration.backends.activation.urls')),

url(r'^accounts/', include('django.contrib.auth.urls')),

.

.

]

o   In here there is an error message (from runserver) ended with:

  File "", line 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'django_registration.backends'



Ø  Commenting out the first url out of the two makes the error go away

Ø  Adding (inside url.py prior to urlpattern declaration):

from django_registration import backends

is resulted with the following error message:

ImportError: cannot import name 'backends' from 'django_registration'
(C:\Users\yuval\OneDrive\pythonWorkDir\django\tutor1\ybsite\django_registration\__init__.py)

(I did not think this line is to be added but wanted to see the
response…). I commented it out.



Ø  This is the case both when in settings.py INSTALLED_APPS I have or don’t
have the following:

 'django_registration',   # <= This one is OK

Ø  Trying to add

 'django_registration.backends',

 #   <= This one is NOT OK : error message:

oduleNotFoundError: No module named 'django_registration.backends'

(I did not think this line is to be added but wanted to see the
response…). I commented it out.



So now I don’t have an error message but also not having Django
registration ready to use…

-- 

Yuval B

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


Re: Setting up environment variable

2019-01-02 Thread Kuber Sodari
Can you screenshot and paste the error shown during running your project?

On Wednesday, 2 January 2019 22:30:56 UTC+5:45, Surajeet Das wrote:
>
> Well , I am really stuck on this setting of environment variable 
> :'DJANGO_SETTINGS_MODULE' . When I run my project in pycharm , an error is 
> raised showing that the environment variable isn't yet set . So , anyone 
> please help me out on this. In which python file do I set this variable and 
> how do I configure it properly .
>

-- 
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/b3289e91-0ef3-4080-8648-146c1b4669ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Setting up environment variable

2019-01-02 Thread Surajeet Das
Well , I am really stuck on this setting of environment variable 
:'DJANGO_SETTINGS_MODULE' . When I run my project in pycharm , an error is 
raised showing that the environment variable isn't yet set . So , anyone 
please help me out on this. In which python file do I set this variable and 
how do I configure it properly .

-- 
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/25d2f9b5-d240-4b6e-a2f2-1905f5e3cb01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: OneToOneField value must be a model instance, not a value?

2019-01-02 Thread Kuber Sodari
>From official documentation 

 
"*to_field* is the field on the related object that the relation is to. By 
default, Django uses the primary key of the related object. If you 
reference a different field, that field must have unique=True." May be read 
it once, you will get some clearance.
I didn't quite understand your use-case though. Can you explain it, which 
field are you using OneToOneField for and why?


On Wednesday, 2 January 2019 21:57:09 UTC+5:45, regtech wrote:
>
> Hello everyone!
> I am a junior who is first using OneToOneField, I found that the value 
> which is giving to the field only could be a instance of the related model, 
> can't be a value of the field which is specifed by the "to_field" ( else 
> django will raise excption ).
> In the other word, "to_field" does not make effect, django performing 
> OneToOneField use PK.
> I feel incomprehension and it makes me trouble on working.
> 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/6b8ccd34-b703-49c6-ad61-d40a3a6e2e9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


OneToOneField value must be a model instance, not a value?

2019-01-02 Thread regtech
Hello everyone!
I am a junior who is first using OneToOneField, I found that the value which is 
giving to the field only could be a instance of the related model, can't be a 
value of the field which is specifed by the "to_field" ( else django will raise 
excption ).

In the other word, "to_field" does not make effect, django performing 
OneToOneField use PK.
I feel incomprehension and it makes me trouble on working.
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/tencent_0C8F5627272A1EB656FAA959560498DB3C05%40qq.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-01-02 Thread Kuber Sodari
Seems like your local server is not running. See the error on terminal or 
cmd from where you are trying to start the server. You must see some error 
there. May be pasting the screenshot of that error might be helpful to 
indicate what is wrong here. 
See the terminal error and try to resolve it first. I guess there should be 
some import error or migration error or something else. Please do check 
first

On Wednesday, 2 January 2019 21:15:40 UTC+5:45, Joseph Gichuki wrote:
>
>  
>
> Here it is
>
> Sent from Mail  for 
> Windows 10
>
>

-- 
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/75a88098-f546-4542-ae98-555920371251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error

2019-01-02 Thread Kuber Sodari
Hmm, I suspect your issue is with queryset there since it says Matching 
Query Doesn't exist. This error always tend to say you that your django 
orm query is not proper, it has certain fields or style that you can not 
perform in the way you have written. First of all, please check if your 
variables values on your queryset 
place = Chapter.objects.get(course__course_name=course_name, slug=slug)
you can't make the query with None values as you have defaulted on your 
method *def chapter(request, course_name=None, slug=None): *
Thus, my guess would be because of these variable values you are getting 
that error. You should have some values there instead of None or else it 
will always have that error.

And another thing I was wondering, why are you not using django 2.0 :D ? 

On Wednesday, 2 January 2019 12:48:18 UTC+5:45, Suresh wrote:
>
> def chapter(request, course_name=None, slug=None):
> place = Chapter.objects.get(course__course_name=course_name, slug=slug)
>
> add_link_form = AddLinkForm(request.POST or None)
> add_txt_form = AddTxtForm(request.POST or None)
> file_upload_form = FileUploadForm(request.POST or None, request.FILES 
> or None)
>
> queryset_txt_block = TextBlock.objects.filter(text_block_fk__id=
> place.id)
> queryset_yt_link = YTLink.objects.filter(yt_link_fk__id=place.id)
> queryset_files = FileUpload.objects.filter(file_fk__id=place.id)
>
> context = {
> "title": place.chapter_name,
> "course_name": course_name,
> "slug": slug,
> "add_link_form": add_link_form,
> "add_txt_form": add_txt_form,
> "queryset_yt_link": queryset_yt_link,
> "queryset_txt_block": queryset_txt_block,
> "queryset_files": queryset_files,
> "path": "Profile",
> "redirect_path": "profile",
> "file_upload_form": file_upload_form,
> }
>

-- 
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/78fa3c92-5caa-495b-b2c4-e2563ec8cfcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-01-02 Thread Alex Kimeu
Is your server running?

On Wed, Jan 2, 2019 at 6:30 PM Joseph Gichuki 
wrote:

>
>
> Here it is
>
> Sent from Mail  for
> Windows 10
>
> --
> 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/5c2cce87.1c69fb81.2d099.3b97%40mx.google.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


*"It's when nothing happens that anything can happen."*
*https://kodenaut.github.io/ **+
254 723494571*

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


Re: Can i build mobile app by django rest framework and restApi???

2019-01-02 Thread Nebojsa Hajdukovic
yes you can make rest api and than frontend in ionic angular (like I have
done) or even flutter.

сре, 2. јан 2019. у 13:54 Andréas Kühne  је
написао/ла:

> Yes - you can use DRF to create the backend for the app. However you would
> need to create the app in a platform specific way (via Xcode on iOS for
> example)
>
> Regards,
>
> Andréas
>
>
> Den ons 2 jan. 2019 kl 13:23 skrev Tomas Adel :
>
>> If i build web via blog can i use restfulApi and django rest framework to
>> build mobile app ???
>>
>> --
>> 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/0fbca035-89ce-471c-bec1-44017a390fc2%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/CAK4qSCfDFiDH9JbtLfqJxBafDezZxH38TmRuQnViMTZPermMKA%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/CAJ60hW2AtOCCfeLa6f5839Lc4g0dPCFktt3XH%2BCghouoiw3TwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[no subject]

2019-01-02 Thread Joseph Gichuki

Here it is
Sent from Mail for Windows 10

-- 
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/5c2cce87.1c69fb81.2d099.3b97%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error

2019-01-02 Thread Bob Gailer
On Jan 2, 2019 2:03 AM, "Suresh"  wrote:
>
> def chapter(request, course_name=None, slug=None):
> place = Chapter.objects.get(course__course_name=course_name,
slug=slug)
>
> add_link_form = AddLinkForm(request.POST or None)
> add_txt_form = AddTxtForm(request.POST or None)
> file_upload_form = FileUploadForm(request.POST or None, request.FILES
or None)
>
> queryset_txt_block = TextBlock.objects.filter(text_block_fk__id=
place.id)
> queryset_yt_link = YTLink.objects.filter(yt_link_fk__id=place.id)
> queryset_files = FileUpload.objects.filter(file_fk__id=place.id)
>
> context = {
> "title": place.chapter_name,
> "course_name": course_name,
> "slug": slug,
> "add_link_form": add_link_form,
> "add_txt_form": add_txt_form,
> "queryset_yt_link": queryset_yt_link,
> "queryset_txt_block": queryset_txt_block,
> "queryset_files": queryset_files,
> "path": "Profile",
> "redirect_path": "profile",
> "file_upload_form": file_upload_form,
> }

What would you like us to do? Personally I won't  / can't do anything with
the code you sent because I don't know what error you got nor do I know the
environment in which you run that code. I sure wish my crystal ball ball
was working.

If I ran that code I would get an error reporting unknown name Chapters.

So give us enough so that we could at least get started. If you got a trace
back please copy and paste the entire traceback.

If you included an attachment it did not come through.

Bob Gailer

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


Re: Help with djangoproject

2019-01-02 Thread abel otugeme
There must be an error that why the server isn't running. Send a screenshot
of  cmd and the site
On Jan 2, 2019 3:12 PM, "Harryxon Ndegwa" 
wrote:
>
> hi joseph,
> send a screenshot of the error and the code u have written so far to get
the error
>
> #%£&
>
> On Wed, 2 Jan 2019 5:10 pm Joseph Gichuki >
>>  Hi am new to Django and I can't get past the Django localhost :8000 to
advance my project to the next step . I keep getting an error:   localhost
refused to connect. what should I do ?
>>
>> --
>> 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/621ac5d3-ad97-45b9-a6f6-0da4ffc58370%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/CAPqDb9PxLxk%3DrzB%2Bm46x9zFOH%3DCmYhF3kGN90xxaKNcxs6HC%3Dg%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/CAMrS0S-kwb376N2TrGB7pc0LFWfyjEAkQ%2Bevy5382x9jZ_HLkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with djangoproject

2019-01-02 Thread Harryxon Ndegwa
hi joseph,
send a screenshot of the error and the code u have written so far to get
the error

#%£&

On Wed, 2 Jan 2019 5:10 pm Joseph Gichuki   Hi am new to Django and I can't get past the Django localhost :8000 to
> advance my project to the next step . I keep getting an error:   localhost
> refused to connect. what should I do ?
>
> --
> 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/621ac5d3-ad97-45b9-a6f6-0da4ffc58370%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/CAPqDb9PxLxk%3DrzB%2Bm46x9zFOH%3DCmYhF3kGN90xxaKNcxs6HC%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Help with djangoproject

2019-01-02 Thread Joseph Gichuki
 Hi am new to Django and I can't get past the Django localhost :8000 to 
advance my project to the next step . I keep getting an error:   localhost 
refused to connect. what should I do ?  

-- 
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/621ac5d3-ad97-45b9-a6f6-0da4ffc58370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DetailView only works with slug and primary key?

2019-01-02 Thread Andréas Kühne
Hi,

The DetailView has a method "get_object" that you can override and use to
return the object via any source you choose.
You can also override the pk_url_kwarg or slug_url_kwarg properties on the
DetailView to retrieve the information from the url in any way you want.

Regards,

Andréas


Den ons 2 jan. 2019 kl 11:20 skrev Osezele Orukpe :

> I would like to know if django DetailView can be used with other fields
> apart from slug and primary key?
>
> --
> 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/d0e15758-e6d3-4f59-9229-9fc4aeb128e0%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/CAK4qSCdP%3DO82qLcR%2BAY%2B%2Ba9LTTSHa0_0v82K4hmBiSnByTfTPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can i build mobile app by django rest framework and restApi???

2019-01-02 Thread Andréas Kühne
Yes - you can use DRF to create the backend for the app. However you would
need to create the app in a platform specific way (via Xcode on iOS for
example)

Regards,

Andréas


Den ons 2 jan. 2019 kl 13:23 skrev Tomas Adel :

> If i build web via blog can i use restfulApi and django rest framework to
> build mobile app ???
>
> --
> 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/0fbca035-89ce-471c-bec1-44017a390fc2%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/CAK4qSCfDFiDH9JbtLfqJxBafDezZxH38TmRuQnViMTZPermMKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to deploy Django Python Webapp with Windows10?

2019-01-02 Thread computer engineering Forum
Hi, any link to a well designed python django website, I am a beginner and
I want to build a good site with login also...anyone with git directory
On Jan 2, 2019 2:11 PM, "Joel Mathew"  wrote:

> Also why are you attempting to deploy it online from your laptop. An
> online application needs to be.. well, online, all the time. That's the
> function of a server. You dont normally deploy from a laptop, unless you
> have a specific need to do so. If it's for a client, definitely a big
> no-no. Use a lightweight Linux distro like Debian, and install a server on
> it (apache/nginx), and run django with mod_wsgi_express.
>
> If you dont know or dont care on installing your own server, just go with
> a built in solution like heroku.
>
> Sincerely yours,
>
>  Joel G Mathew
>
>
>
> On Tue, 1 Jan 2019 at 02:14, gian castillo  wrote:
>
>> Hi,
>> I built a webapp with django python and It's done. Now I want to deploy
>> It online, It's just a portfolio website for my first client, nothing too
>> heavy.
>>
>> I looked into Digital Ocean but It deploys It with ubuntu and I'm having
>> troubles in turning my laptop into a deul boot(working on WIndows10).
>> Can I deploy my webapp with just Windows10? I downloaded VirtualBox for
>> Ubuntu 16.04.
>> I really am new to this so I know very little.
>>
>> Thank You and kind regards.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/a66e6618-8adc-4788-b320-e488e73b0831%
>> 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/CAA%3Diw_8t4D1Sdm0L6BBH7v_TfJ4trCu_
> w6XMoxBZSXXUkwEQOg%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/CAGxZvmJvg0MOYvVxxNV2bH_O%3DeWWxtFsJMDOyUjo1iKdF9bvSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Can i build mobile app by django rest framework and restApi???

2019-01-02 Thread Tomas Adel
If i build web via blog can i use restfulApi and django rest framework to build 
mobile app ??? 

-- 
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/0fbca035-89ce-471c-bec1-44017a390fc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting ios app to django as backend And represent the location data in maps.

2019-01-02 Thread mazz ahmed
:D

On Wed, Jan 2, 2019 at 3:20 PM Achyut Pandey 
wrote:

>
> Hello guys i am working on project named “real time user tracking system”
> using django as a backend. The problem i faced to build this project is how 
> can
> i get data ( about location ) sent from ios app to my django site in real
> time and shows those longitude and latitude values in maps to track the
> user. Any informations and suggestions are helpful thanks in advanced. ☺️
>
> --
> 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/95EB2CC3-0938-40A0-B076-3D22B82411CA%40gmail.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/CABuXbh9cfMjrnu6mMsEOODfh5Z-jw0E_ZFNvv7_hP8sZ9qt3jA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to deploy Django Python Webapp with Windows10?

2019-01-02 Thread Joel Mathew
Also why are you attempting to deploy it online from your laptop. An online
application needs to be.. well, online, all the time. That's the function
of a server. You dont normally deploy from a laptop, unless you have a
specific need to do so. If it's for a client, definitely a big no-no. Use a
lightweight Linux distro like Debian, and install a server on it
(apache/nginx), and run django with mod_wsgi_express.

If you dont know or dont care on installing your own server, just go with a
built in solution like heroku.

Sincerely yours,

 Joel G Mathew



On Tue, 1 Jan 2019 at 02:14, gian castillo  wrote:

> Hi,
> I built a webapp with django python and It's done. Now I want to deploy It
> online, It's just a portfolio website for my first client, nothing too
> heavy.
>
> I looked into Digital Ocean but It deploys It with ubuntu and I'm having
> troubles in turning my laptop into a deul boot(working on WIndows10).
> Can I deploy my webapp with just Windows10? I downloaded VirtualBox for
> Ubuntu 16.04.
> I really am new to this so I know very little.
>
> Thank You and kind regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a66e6618-8adc-4788-b320-e488e73b0831%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/CAA%3Diw_8t4D1Sdm0L6BBH7v_TfJ4trCu_w6XMoxBZSXXUkwEQOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to deploy Django Python Webapp with Windows10?

2019-01-02 Thread Joel Mathew
Windows 10 is not designed to be a server. What is your issue in deploying
in Ubuntu or Debian?

Sincerely yours,

 Joel G Mathew



On Tue, 1 Jan 2019 at 02:14, gian castillo  wrote:

> Hi,
> I built a webapp with django python and It's done. Now I want to deploy It
> online, It's just a portfolio website for my first client, nothing too
> heavy.
>
> I looked into Digital Ocean but It deploys It with ubuntu and I'm having
> troubles in turning my laptop into a deul boot(working on WIndows10).
> Can I deploy my webapp with just Windows10? I downloaded VirtualBox for
> Ubuntu 16.04.
> I really am new to this so I know very little.
>
> Thank You and kind regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a66e6618-8adc-4788-b320-e488e73b0831%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/CAA%3Diw_8t7b82%2B_LZtcvSUFDysORFNdbH%2BApAcx1XwyQPSez5Rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Posting data from templates to views.py without using forms.

2019-01-02 Thread Osezele Orukpe
I guess you not using a frontend framework like reactJs or AngularJs. So i 
would suggest you look into AJAX. this could be done easily using jQuery's 
ajax function

On Tuesday, January 1, 2019 at 3:46:53 PM UTC+1, Surajeet Das wrote:
>
> Well , I want to post data from templates to views.py by clicking a button 
> without using forms. Basically the button should not be of type submit 
> because I don't want the page to be refreshed .I want to view the data from 
> database after the query in the same page. 
>

-- 
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/bad4bd66-fc52-4489-9ab8-8fa47ee1848c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Itterate with Include Tag

2019-01-02 Thread Osezele Orukpe
Hi Shazia,
Can you post the included file?

On Saturday, December 29, 2018 at 11:51:29 PM UTC+1, Shazia Nusrat wrote:
>
> Hi Guys,
>
> I have a form created from foreignkey model. I have used "include" with 
> jinja for displaying my fields. But I don't know how to iterate through and 
> include tag.
> % 
> Below is the code and I would appreciate if someone can help me to iterate 
> through following template code.
>
> {% for field in form %}
> {% include 'includes/form/form_fields.html' with form=field.myform %}
> {% endfor %)
> I can't get fields from the form. Please advise.
> Looking forward to your feedback. :-)
>

-- 
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/b2056d0f-359f-4705-a81b-7be6dd3784e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


DetailView only works with slug and primary key?

2019-01-02 Thread Osezele Orukpe
I would like to know if django DetailView can be used with other fields 
apart from slug and primary key?

-- 
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/d0e15758-e6d3-4f59-9229-9fc4aeb128e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Connecting ios app to django as backend And represent the location data in maps.

2019-01-02 Thread Achyut Pandey

Hello guys i am working on project named “real time user tracking system” using 
django as a backend. The problem i faced to build this project is how can i get 
data ( about location ) sent from ios app to my django site in real time and 
shows those longitude and latitude values in maps to track the user. Any 
informations and suggestions are helpful thanks in advanced. ☺️

-- 
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/95EB2CC3-0938-40A0-B076-3D22B82411CA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to deploy Django Python Webapp with Windows10?

2019-01-02 Thread Kuber Sodari
My suggestion would be pythonanywhere.com  Its 
free and reliable for the testing or demo purposes.

On Tuesday, 1 January 2019 02:29:10 UTC+5:45, gian castillo wrote:
>
> Hi,
> I built a webapp with django python and It's done. Now I want to deploy It 
> online, It's just a portfolio website for my first client, nothing too 
> heavy.
>
> I looked into Digital Ocean but It deploys It with ubuntu and I'm having 
> troubles in turning my laptop into a deul boot(working on WIndows10).
> Can I deploy my webapp with just Windows10? I downloaded VirtualBox for 
> Ubuntu 16.04.
> I really am new to this so I know very little.
>
> Thank You and kind regards.
>

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


Get the list of related objects in Django

2019-01-02 Thread Tessnim Zrayga


I have 3 models:

class Node(models.Model):
ID = models.DecimalField(max_digits=19, decimal_places=10)
name = models.CharField(default='node', max_length=32)
connexion = models.CharField(max_length=255)
# Many2one fields | Foreign keys:
firm = models.ForeignKey('firme.Firme', on_delete=models.CASCADE, 
null=True, blank=True)

class ScheduledAction(models.Model):
date = models.DateTimeField(default=datetime.now, blank=True)
firm = models.ForeignKey('firme.Firme', on_delete=models.CASCADE, 
null=True, blank=True)
node_ids = models.ManyToManyField(Node)

I want in ScheduledAction form to show, for a selected firm, the list of 
its related nodes. Normally I should do this by get:

class ScheduledActionForm(forms.ModelForm):
date = forms.DateTimeField()
firm = forms.ModelChoiceField(queryset=Firme.objects.all())
node_ids = 
forms.ModelMultipleChoiceField(queryset=Node.objects.get(firm_id=firm.id), 
widget=forms.CheckboxSelectMultiple)

class Meta:
model = ScheduledAction
fields = [
'date',
'firm',
'node_ids'
]

But I got this error:

AttributeError: 'ModelChoiceField' object has no attribute 'id'

How can I fix this?


This is my post 
in
 
StackOverFlow.

-- 
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/fa7eeab7-2ee6-40c1-b648-3837bb18cdd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.