Re: CharField vs ImageField for Logo

2017-09-26 Thread Andréas Kühne
Hi,

great that you are getting how the media settings work.

If you look at this page :
https://docs.djangoproject.com/en/1.11/howto/static-files/ it explains what
static files are and how they work.  Basically, you use the static files
template tags in your html templates and then you can use the same solution
in development as in production. It's mainly good if you for example are
serving your static files from your computer in development, but from a CDN
i production (we do that on a project I wrote) and you then don't have to
change anything but the settings file in production.

The reason you need to add the configuration to your settings file is
because the django runserver process doesn't know where to serve your files
from otherwise. There are no "reasonable" defaults for those settings.

Hope that helps!

Andréas

2017-09-26 0:40 GMT+02:00 tango ward :

> Hi Andreas,
>
>
> I was able to display the images but I dont know how they work. I checked
> some online resources and found out that I need to add these in my urls.py
>
> from django.conf import settings
> from django.conf.urls.static import static
>
> and at the bottom of it, I added
>
> if settings.DEBUG:
> urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_
> ROOT)
>
>
> I also saw a urlpattern for STATIC_URL and STATIC_ROOT.
>
> Would you have a minute or two to help me understand these codes?
>
> I would really appreciate it.
>
>
> Thanks
>
> On Tue, Sep 26, 2017 at 5:23 AM, tango ward  wrote:
>
>> Hi Andreas,
>>
>>
>> Really appreciate your guidance on this.
>>
>> I am having trouble understanding this:
>>
>> 3: All that will be stored in your database is a path to the file
>> (relative to MEDIA_ROOT
>> ).
>> You’ll most likely want to use the convenience url
>> 
>> attribute provided by Django. For example, if your ImageField
>> 
>> is called mug_shot, you can get the absolute path to your image in a
>> template with {{ object.mug_shot.url }}.
>>
>>
>> I tried applying the object.logo.url but the logo still doesn't display.
>> Also where did the object and url came from?
>>
>> On Tue, Sep 26, 2017 at 3:39 AM, Andréas Kühne <
>> andreas.ku...@hypercode.se> wrote:
>>
>>> Hi,
>>>
>>> I think you've made a lot of progress!
>>>
>>> The only thing I think you are missing now is that you should be using
>>> the following in your template:
>>> 
>>>
>>> See: https://docs.djangoproject.com/en/1.11/ref/models/fields/#filefield
>>> and https://docs.djangoproject.com/en/1.11/ref/models/fields
>>> /#django.db.models.fields.files.FieldFile.url
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> 2017-09-25 20:38 GMT+02:00 tango ward :
>>>
 Hi Andréas,


 Thank you for the response.

 I added these lines in my settings.py

 MEDIA_DIR = os.path.join(BASE_DIR, 'media')

 # Media

 MEDIA_ROOT = MEDIA_DIR
 MEDIA_URL = '/media/

 Then I changed my logo to models.ImageField(upload_to='team_logo'). I
 also created a 'media' folder inside my project folder which team_logo is a
 subfolder in it. Tried running the codes again but the logo still wont
 show.


 {% block body_block %}

 
 
 {% for team in teams %}
 

 
  

 {{ team.name }}
 
 {% endfor %}
 


 {% endblock %}


 Is there any setting that I missed in media for media?


 Thanks,
 Jarvis

 On Mon, Sep 25, 2017 at 9:10 PM, Andréas Kühne <
 andreas.ku...@hypercode.se> wrote:

> Hi,
>
> There are a couple of things to think about here.
>
> First of all - just because you put an item on your computer doesn't
> mean that the icon can be served. For example, if you are running windows
> and you enter 'C:\pictures\icon.jpg' as the source for the icon, your
> server won't be able to find it, because the reference
> 'C:\pictures\icon.jpg' doesn't mean anything for the web browser. The
> reason the image links you are inputting work is because they probably
> contain all information, ie http://www.example.com/pictures/icon.jpg.
>
> So you can get that sorted and everything should work. HOWEVER, I
> really think you should use the media storage functionality of Django for
> this. Checkout : https://docs.djangoproject.com/en/1.11/topics/files/.
>
> If you add the settings required (MEDIA_ROOT in the settings file) and
> then change you logo from a CharField to an ImageField AND upload your 
> file
> via django admin, you should be able to show your file.
>
> Regards,
>
> Andréas

Re: POST method on localhost

2017-09-26 Thread Andréas Kühne
Hi!

Yes that is realistic in the sense that it takes a couple of seconds to
upload a 1GB file to localhost. It should take a small amount of time,
because it is just copying the file (through django) to the directory you
specified.

However uploading a 1 GB file to a web server on the Internet isn't
feasible. It would probably take to long to upload and the connection would
time out - unless you do a bit of magic on the connections.

So, my question to you is what are you trying to accomplish? What is the
purpose of your test?

Regards,

Andréas

2017-09-25 22:42 GMT+02:00 Allan :

> I've created a simple form for data upload.  I'm testing it through
> localhost and was wondering if this is realistic.  Web development is a new
> area for me so bare with me please if this is a laughable question.  I
> uploaded a 1GB file and it was uploaded and moved to a folder in my project
> in a matter of a few seconds.
>
> def simple_upload(request):
> if request.method =='POST' and request.FILES['myfile']:
> myfile = request.FILES['myfile']
> fs = FileSystemStorage()
> filename = fs.save(myfile.name, myfile)
> uploaded_file_url = fs.url(filename)
> return render(request, 'simple_upload.html', {
> 'uploaded_file_url': uploaded_file_url
> })
>
> return render(request, 'simple_upload.html')
>
> {% load static %}
>
> {% block content %}
>   
> {% csrf_token %}
> 
> Upload
>   
>
>   {% if uploaded_file_url %}
> File uploaded at: {{
> uploaded_file_url }}
>   {% endif %}
>
>   Return to home
> {% endblock %}
>
> 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/bf2476d2-8470-4c91-8590-99ecc4f477de%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/CAK4qSCfsUgR91_9dKgoW%2B8Lz_VvyhzdJ%3DXkTqOXyUfiZXyx7uA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: CharField vs ImageField for Logo

2017-09-26 Thread tango ward
Got it. Thanks a lot!!

On Tue, Sep 26, 2017 at 3:33 PM, Andréas Kühne 
wrote:

> Hi,
>
> great that you are getting how the media settings work.
>
> If you look at this page : https://docs.djangoproject.
> com/en/1.11/howto/static-files/ it explains what static files are and how
> they work.  Basically, you use the static files template tags in your html
> templates and then you can use the same solution in development as in
> production. It's mainly good if you for example are serving your static
> files from your computer in development, but from a CDN i production (we do
> that on a project I wrote) and you then don't have to change anything but
> the settings file in production.
>
> The reason you need to add the configuration to your settings file is
> because the django runserver process doesn't know where to serve your files
> from otherwise. There are no "reasonable" defaults for those settings.
>
> Hope that helps!
>
> Andréas
>
> 2017-09-26 0:40 GMT+02:00 tango ward :
>
>> Hi Andreas,
>>
>>
>> I was able to display the images but I dont know how they work. I checked
>> some online resources and found out that I need to add these in my urls.py
>>
>> from django.conf import settings
>> from django.conf.urls.static import static
>>
>> and at the bottom of it, I added
>>
>> if settings.DEBUG:
>> urlpatterns += static(settings.MEDIA_URL,
>> document_root=settings.MEDIA_ROOT)
>>
>>
>> I also saw a urlpattern for STATIC_URL and STATIC_ROOT.
>>
>> Would you have a minute or two to help me understand these codes?
>>
>> I would really appreciate it.
>>
>>
>> Thanks
>>
>> On Tue, Sep 26, 2017 at 5:23 AM, tango ward 
>> wrote:
>>
>>> Hi Andreas,
>>>
>>>
>>> Really appreciate your guidance on this.
>>>
>>> I am having trouble understanding this:
>>>
>>> 3: All that will be stored in your database is a path to the file
>>> (relative to MEDIA_ROOT
>>> ).
>>> You’ll most likely want to use the convenience url
>>> 
>>> attribute provided by Django. For example, if your ImageField
>>> 
>>> is called mug_shot, you can get the absolute path to your image in a
>>> template with {{ object.mug_shot.url }}.
>>>
>>>
>>> I tried applying the object.logo.url but the logo still doesn't display.
>>> Also where did the object and url came from?
>>>
>>> On Tue, Sep 26, 2017 at 3:39 AM, Andréas Kühne <
>>> andreas.ku...@hypercode.se> wrote:
>>>
 Hi,

 I think you've made a lot of progress!

 The only thing I think you are missing now is that you should be using
 the following in your template:
 

 See: https://docs.djangoproject.com/en/1.11/ref/models/field
 s/#filefield and https://docs.djangoproject
 .com/en/1.11/ref/models/fields/#django.db.models.fields.file
 s.FieldFile.url

 Regards,

 Andréas

 2017-09-25 20:38 GMT+02:00 tango ward :

> Hi Andréas,
>
>
> Thank you for the response.
>
> I added these lines in my settings.py
>
> MEDIA_DIR = os.path.join(BASE_DIR, 'media')
>
> # Media
>
> MEDIA_ROOT = MEDIA_DIR
> MEDIA_URL = '/media/
>
> Then I changed my logo to models.ImageField(upload_to='team_logo'). I
> also created a 'media' folder inside my project folder which team_logo is 
> a
> subfolder in it. Tried running the codes again but the logo still wont
> show.
>
>
> {% block body_block %}
>
> 
> 
> {% for team in teams %}
> 
>
> 
>  
>
> {{ team.name }}
> 
> {% endfor %}
> 
>
>
> {% endblock %}
>
>
> Is there any setting that I missed in media for media?
>
>
> Thanks,
> Jarvis
>
> On Mon, Sep 25, 2017 at 9:10 PM, Andréas Kühne <
> andreas.ku...@hypercode.se> wrote:
>
>> Hi,
>>
>> There are a couple of things to think about here.
>>
>> First of all - just because you put an item on your computer doesn't
>> mean that the icon can be served. For example, if you are running windows
>> and you enter 'C:\pictures\icon.jpg' as the source for the icon, your
>> server won't be able to find it, because the reference
>> 'C:\pictures\icon.jpg' doesn't mean anything for the web browser. The
>> reason the image links you are inputting work is because they probably
>> contain all information, ie http://www.example.com/pictures/icon.jpg.
>>
>> So you can get that sorted and everything should work. HOWEVER, I
>> really think you should use the media storage functionality of Django for
>> this. Checkout : https://docs.djangoproject.com/en/1.11/topics/files/
>> .

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

2017-09-26 Thread 'Federico Capoano' via Django users
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/5add2c0f-3a30-46ea-91b8-c02f01d2ad5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Server side paging..How to sent the count of items??

2017-09-26 Thread Rakhee Menon
Hi ,

I was trying to do server side paging and wanted to send the totalcount of 
items along with itemPerPage..I have attached my code.Can anyone suggest 
how to do it??

Thanks in Advance.

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


Server Side Paging...How to get the totalcount of items?

2017-09-26 Thread Rakhee Menon
Hi ,

I was trying to do server side paging and wanted to send the totalcount of 
items along with itemPerPage..I have attached my code.Can anyone suggest 
how to do it??

Thanks in Advance.

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


Re: Server Side Paging...How to get the totalcount of items?

2017-09-26 Thread Daniel Roseman
On Tuesday, 26 September 2017 11:29:45 UTC+1, Rakhee Menon wrote:
>
> Hi ,
>
> I was trying to do server side paging and wanted to send the totalcount of 
> items along with itemPerPage..I have attached my code.Can anyone suggest 
> how to do it??
>
> Thanks in Advance.
>

Please don't post code as pictures.

The pagination docs list all the attributes of Paginator objects, including 
`.count` which is described as "The total number of objects, across all 
pages.". 
See 
https://docs.djangoproject.com/en/1.11/topics/pagination/#django.core.paginator.Paginator.count
--
DR. 

-- 
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/5e302e30-f525-4e11-8d2f-1efe43f286e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help formatting and incrementing a form in HTML

2017-09-26 Thread Daniel Roseman
On Monday, 25 September 2017 21:16:04 UTC+1, Zev wrote:
>
> So say I have data "a", "b", and "c". It would display itself as
>
> Object: a
>
> Object: b
>
> Object: c
>
> If I added d to the form, it would add
>
> Object: d
>
> What I'm hoping to do is add an increment to this so it displays itself as
>
> Object 1: a
>
> Object 2: b
>
> Object 3: c
>
> And add d as
>
> Object 4:
>
> How would I go about implementing this? Another thing I wanted to know is 
> whether I can change the "Post:" comment next to the form. Right now my 
> form displays itself with "Post:" at the left side. Is there a way to edit 
> this?
>
>
>
I'm not sure what you're asking. If you want to enumerate objects within a 
for loop in the template, just use `{{ forloop.counter }}`. 
--
DR. 

-- 
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/089b376a-4916-4054-abb9-6698d18cdc78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Solved Re: NoReverseMatch at /registration/password/change/

2017-09-26 Thread NoviceSortOf
Thanks for your reply. 

>>> Did you add all auth URLs to your URLconf? 


Thanks, we resolved the problems, by updating auth URLs as you mentioned 
and then also 
modifying the related registration html pages, and custom registration 
views.

>> Also, please upgrade to at least Django 1.8 or (preferably) 1.11 they 
receive support for 

>> security issues while Django 1.6 does not.


We appreciate the value of security updates, for now we must depend 
the variety of up to date mechanisms and services to block hacking and 
attacks provided by our web provider.

We have found upgrading between versions of Django not trivial.

We would hope that the upgrade from 1.6 to 1.8 would go smoother, at the 
moment though 
we don't have the budget/resources to block  time for the task, even at the 
lower amount 
of estimated hours likely to be required.

Perhaps another thread, It would be interesting to know how many work hours 
other Django users spend with updates, and Linux distro migrations, I would 
suspect there would be a wide spectrum of cases, with more 
complex systems that include legacy customizations (such as ours) having a 
similar experience
with version upgrades being a non-trivial task.

Thanks

On Wednesday, September 20, 2017 at 2:03:27 PM UTC+2, NoviceSortOf wrote:
>
>
> ...When attempting to use our 
> template/registration/password_change_form.html
>
> While Login, request password, logout and related functions are working 
> without a problem.
>
> When using password change we get the following error 
> "NoReverseMatch at /registration/password/change/"
>  [SEE.: Full traceback below]
>
> We are using Django 1.6
>
> * Can anyone provide any insight as to why this might be occurring, 
> solutions, or troubleshooting tips.
>
> 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/4b2b3af4-4c29-468f-83e1-fa5950761e5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Timezone error when I launch the admin login screen in 'Writing your first Django app'-tutorial

2017-09-26 Thread Lise
Hi,

I'm trying to learn how to use Django through the 'Writing your first 
Django app'-tuorial. I have reached the step where you create a superuser 
and you need to start the server and go to the local domain and see the 
admin login screen. I don't see the admin login screen, I see a message 
that says 

*'A server error occurred. Please contact the administrator.' *

and in the command prompt it says 

*'File 
"C:\Users\lbl\Anaconda3\envs\reports\lib\site-packages\pytz\__init__.py", 
line 181, in timezone raise UnknownTimeZoneError(zone) 
pytz.exceptions.UnknownTimeZoneError: 'UTC+01:00''*

I am working on a Windows computer, so it might be something about the time 
settings on the computer not being convertible with the settings in Django. 
Does anyone know how to fix this? :)

I am very new to this, so please forgive me for being a newbie in some 
aspects!

-- 
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/537b282e-e553-41c2-8ccf-4533090c45b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timezone error when I launch the admin login screen in 'Writing your first Django app'-tutorial

2017-09-26 Thread Dan Tagg
Check the Django Settings file and set

TIME_ZONE = 'UTC'


or something in this list
http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

Dan

On 26 September 2017 at 14:30, Lise  wrote:

> Hi,
>
> I'm trying to learn how to use Django through the 'Writing your first
> Django app'-tuorial. I have reached the step where you create a superuser
> and you need to start the server and go to the local domain and see the
> admin login screen. I don't see the admin login screen, I see a message
> that says
>
> *'A server error occurred. Please contact the administrator.' *
>
> and in the command prompt it says
>
> *'File
> "C:\Users\lbl\Anaconda3\envs\reports\lib\site-packages\pytz\__init__.py",
> line 181, in timezone raise UnknownTimeZoneError(zone)
> pytz.exceptions.UnknownTimeZoneError: 'UTC+01:00''*
>
> I am working on a Windows computer, so it might be something about the
> time settings on the computer not being convertible with the settings in
> Django. Does anyone know how to fix this? :)
>
> I am very new to this, so please forgive me for being a newbie in some
> aspects!
>
> --
> 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/537b282e-e553-41c2-8ccf-4533090c45b0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Wildman and Herring Limited, Registered Office: 28 Brock Street, Bath,
United Kingdom, BA1 2LN, Company no: 05766374

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


{% csrf_token %}

2017-09-26 Thread Alex Kleider
I'm using test driven development (going through Harry J.W. Percival's 
book) and have found that the following code fails because the template tag 
( {% csrf_token %} ) is rendered by the home_page view function but not by 
the django.template.loader.render_to_string function (and so the 
assertEqual test fails.)

...templates/home.html:
...

 
{% csrf_token %}
 
...

Testing code:

def test_home_page_returns_correct_html(self):
request = HttpRequest()
response = home_page(request)
returned_html = response.content.decode()
expected_html = render_to_string('home.html')
self.assertEqual(returned_html , expected_html)

returned_html and expected_html are the same except that returned_html 
contains the following line (and the other doesn't:)

Infact, expected_html doesn't even contain the
{% csrf_token %}
line.

Can anyone suggest a work around?
Thanks in advance.

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


Re: POST method on localhost

2017-09-26 Thread Allan
Andreas my supervisor has asked me to determine the feasibility of using 
different frameworks for our web application.  Django seems nice to work 
with mainly because it is in Python and that gives us a lot.  Will 
different frameworks result in a huge difference in aspects such as data 
upload?  We are new to web development and at this stage we are doing 
research, and this would be a nice example to show.

On Tuesday, 26 September 2017 00:37:58 UTC-7, Andréas Kühne wrote:
>
> Hi!
>
> Yes that is realistic in the sense that it takes a couple of seconds to 
> upload a 1GB file to localhost. It should take a small amount of time, 
> because it is just copying the file (through django) to the directory you 
> specified.
>
> However uploading a 1 GB file to a web server on the Internet isn't 
> feasible. It would probably take to long to upload and the connection would 
> time out - unless you do a bit of magic on the connections. 
>
> So, my question to you is what are you trying to accomplish? What is the 
> purpose of your test?
>
> Regards,
>
> Andréas
>
> 2017-09-25 22:42 GMT+02:00 Allan >:
>
>> I've created a simple form for data upload.  I'm testing it through 
>> localhost and was wondering if this is realistic.  Web development is a new 
>> area for me so bare with me please if this is a laughable question.  I 
>> uploaded a 1GB file and it was uploaded and moved to a folder in my project 
>> in a matter of a few seconds.
>>
>> def simple_upload(request):
>> if request.method =='POST' and request.FILES['myfile']:
>> myfile = request.FILES['myfile']
>> fs = FileSystemStorage()
>> filename = fs.save(myfile.name, myfile)
>> uploaded_file_url = fs.url(filename)
>> return render(request, 'simple_upload.html', {
>> 'uploaded_file_url': uploaded_file_url
>> })
>>
>> return render(request, 'simple_upload.html')
>>
>> {% load static %}
>>
>> {% block content %}
>>   
>> {% csrf_token %}
>> 
>> Upload
>>   
>>
>>   {% if uploaded_file_url %}
>> File uploaded at: {{ 
>> uploaded_file_url }}
>>   {% endif %}
>>
>>   Return to home
>> {% endblock %}
>>
>> 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...@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/bf2476d2-8470-4c91-8590-99ecc4f477de%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/b3d9b14e-7adc-407a-8771-131e01877fec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: POST method on localhost

2017-09-26 Thread Andréas Kühne
Hi again,

Different frameworks will probably not affect your upload speed. The web
server (regardless of framework) is not the main problem, but the network
speed, so regardless of which framework you choose in the end, it won't be
the bottleneck. The thing is your web server is probably not even in the
same country as you and the network connection will be the bottleneck for
all frameworks. Not even if you are on the same network, the framework
speed would be an issue.

But even so - you should probably think a bit more about design if you want
to upload 1GB files - the web server itself will first of all be busy
taking care of the files, and then you will need a very large harddrive to
store the files?

I think you should probably look into more useful use cases and see if the
framework is good for you in that regard.

Regards,

Andréas

2017-09-26 22:16 GMT+02:00 Allan :

> Andreas my supervisor has asked me to determine the feasibility of using
> different frameworks for our web application.  Django seems nice to work
> with mainly because it is in Python and that gives us a lot.  Will
> different frameworks result in a huge difference in aspects such as data
> upload?  We are new to web development and at this stage we are doing
> research, and this would be a nice example to show.
>
> On Tuesday, 26 September 2017 00:37:58 UTC-7, Andréas Kühne wrote:
>>
>> Hi!
>>
>> Yes that is realistic in the sense that it takes a couple of seconds to
>> upload a 1GB file to localhost. It should take a small amount of time,
>> because it is just copying the file (through django) to the directory you
>> specified.
>>
>> However uploading a 1 GB file to a web server on the Internet isn't
>> feasible. It would probably take to long to upload and the connection would
>> time out - unless you do a bit of magic on the connections.
>>
>> So, my question to you is what are you trying to accomplish? What is the
>> purpose of your test?
>>
>> Regards,
>>
>> Andréas
>>
>> 2017-09-25 22:42 GMT+02:00 Allan :
>>
>>> I've created a simple form for data upload.  I'm testing it through
>>> localhost and was wondering if this is realistic.  Web development is a new
>>> area for me so bare with me please if this is a laughable question.  I
>>> uploaded a 1GB file and it was uploaded and moved to a folder in my project
>>> in a matter of a few seconds.
>>>
>>> def simple_upload(request):
>>> if request.method =='POST' and request.FILES['myfile']:
>>> myfile = request.FILES['myfile']
>>> fs = FileSystemStorage()
>>> filename = fs.save(myfile.name, myfile)
>>> uploaded_file_url = fs.url(filename)
>>> return render(request, 'simple_upload.html', {
>>> 'uploaded_file_url': uploaded_file_url
>>> })
>>>
>>> return render(request, 'simple_upload.html')
>>>
>>> {% load static %}
>>>
>>> {% block content %}
>>>   
>>> {% csrf_token %}
>>> 
>>> Upload
>>>   
>>>
>>>   {% if uploaded_file_url %}
>>> File uploaded at: {{
>>> uploaded_file_url }}
>>>   {% endif %}
>>>
>>>   Return to home
>>> {% endblock %}
>>>
>>> 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...@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/ms
>>> gid/django-users/bf2476d2-8470-4c91-8590-99ecc4f477de%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/b3d9b14e-7adc-407a-8771-131e01877fec%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

Re: POST method on localhost

2017-09-26 Thread Allan
Would you have any recommendations on where to get started with this?  We 
were originally making a desktop application, but plans have shifted and 
I'm not very knowledgeable about everything web.  

Allan

On Tuesday, 26 September 2017 13:35:08 UTC-7, Andréas Kühne wrote:
>
> Hi again,
>
> Different frameworks will probably not affect your upload speed. The web 
> server (regardless of framework) is not the main problem, but the network 
> speed, so regardless of which framework you choose in the end, it won't be 
> the bottleneck. The thing is your web server is probably not even in the 
> same country as you and the network connection will be the bottleneck for 
> all frameworks. Not even if you are on the same network, the framework 
> speed would be an issue.
>
> But even so - you should probably think a bit more about design if you 
> want to upload 1GB files - the web server itself will first of all be busy 
> taking care of the files, and then you will need a very large harddrive to 
> store the files?
>
> I think you should probably look into more useful use cases and see if the 
> framework is good for you in that regard.
>
> Regards,
>
> Andréas
>
> 2017-09-26 22:16 GMT+02:00 Allan >:
>
>> Andreas my supervisor has asked me to determine the feasibility of using 
>> different frameworks for our web application.  Django seems nice to work 
>> with mainly because it is in Python and that gives us a lot.  Will 
>> different frameworks result in a huge difference in aspects such as data 
>> upload?  We are new to web development and at this stage we are doing 
>> research, and this would be a nice example to show.
>>
>> On Tuesday, 26 September 2017 00:37:58 UTC-7, Andréas Kühne wrote:
>>>
>>> Hi!
>>>
>>> Yes that is realistic in the sense that it takes a couple of seconds to 
>>> upload a 1GB file to localhost. It should take a small amount of time, 
>>> because it is just copying the file (through django) to the directory you 
>>> specified.
>>>
>>> However uploading a 1 GB file to a web server on the Internet isn't 
>>> feasible. It would probably take to long to upload and the connection would 
>>> time out - unless you do a bit of magic on the connections. 
>>>
>>> So, my question to you is what are you trying to accomplish? What is the 
>>> purpose of your test?
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> 2017-09-25 22:42 GMT+02:00 Allan :
>>>
 I've created a simple form for data upload.  I'm testing it through 
 localhost and was wondering if this is realistic.  Web development is a 
 new 
 area for me so bare with me please if this is a laughable question.  I 
 uploaded a 1GB file and it was uploaded and moved to a folder in my 
 project 
 in a matter of a few seconds.

 def simple_upload(request):
 if request.method =='POST' and request.FILES['myfile']:
 myfile = request.FILES['myfile']
 fs = FileSystemStorage()
 filename = fs.save(myfile.name, myfile)
 uploaded_file_url = fs.url(filename)
 return render(request, 'simple_upload.html', {
 'uploaded_file_url': uploaded_file_url
 })

 return render(request, 'simple_upload.html')

 {% load static %}

 {% block content %}
   
 {% csrf_token %}
 
 Upload
   

   {% if uploaded_file_url %}
 File uploaded at: {{ 
 uploaded_file_url }}
   {% endif %}

   Return to home
 {% endblock %}

 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...@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/bf2476d2-8470-4c91-8590-99ecc4f477de%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...@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/b3d9b14e-7adc-407a-8771-131e01877fec%40googlegroups.com
>>  
>> 
>> 

Re: POST method on localhost

2017-09-26 Thread Andréas Kühne
I think most frameworks are pretty much the same today.

What you should be looking for is something that you feel comfortable with.
If you have been programming in java - look for a java framework. If you
have been programming in python - look for a python framework. That being
said, I personally prefer the python and django mindset of "batteries
included" - there is just so much included in python and the django
framework.

The next thing to consider is how you want the application itself to work -
how your user should interact with the application - be that a standard MVC
or if you want to create a single page application, more like a desktop
application.

And the final thing to consider is if you want to be able to create other
applications that will connect to the server (for example mobile phone
apps).

All of this will help you evaluate what kind of framework and how the
application should be created.

I would recommend that you get some experience with HTML / CSS / Javascript
for all of the solutions - you will probably need it anyway.

Regards,

Andréas

2017-09-26 22:57 GMT+02:00 Allan :

> Would you have any recommendations on where to get started with this?  We
> were originally making a desktop application, but plans have shifted and
> I'm not very knowledgeable about everything web.
>
> Allan
>
> On Tuesday, 26 September 2017 13:35:08 UTC-7, Andréas Kühne wrote:
>>
>> Hi again,
>>
>> Different frameworks will probably not affect your upload speed. The web
>> server (regardless of framework) is not the main problem, but the network
>> speed, so regardless of which framework you choose in the end, it won't be
>> the bottleneck. The thing is your web server is probably not even in the
>> same country as you and the network connection will be the bottleneck for
>> all frameworks. Not even if you are on the same network, the framework
>> speed would be an issue.
>>
>> But even so - you should probably think a bit more about design if you
>> want to upload 1GB files - the web server itself will first of all be busy
>> taking care of the files, and then you will need a very large harddrive to
>> store the files?
>>
>> I think you should probably look into more useful use cases and see if
>> the framework is good for you in that regard.
>>
>> Regards,
>>
>> Andréas
>>
>> 2017-09-26 22:16 GMT+02:00 Allan :
>>
>>> Andreas my supervisor has asked me to determine the feasibility of using
>>> different frameworks for our web application.  Django seems nice to work
>>> with mainly because it is in Python and that gives us a lot.  Will
>>> different frameworks result in a huge difference in aspects such as data
>>> upload?  We are new to web development and at this stage we are doing
>>> research, and this would be a nice example to show.
>>>
>>> On Tuesday, 26 September 2017 00:37:58 UTC-7, Andréas Kühne wrote:

 Hi!

 Yes that is realistic in the sense that it takes a couple of seconds to
 upload a 1GB file to localhost. It should take a small amount of time,
 because it is just copying the file (through django) to the directory you
 specified.

 However uploading a 1 GB file to a web server on the Internet isn't
 feasible. It would probably take to long to upload and the connection would
 time out - unless you do a bit of magic on the connections.

 So, my question to you is what are you trying to accomplish? What is
 the purpose of your test?

 Regards,

 Andréas

 2017-09-25 22:42 GMT+02:00 Allan :

> I've created a simple form for data upload.  I'm testing it through
> localhost and was wondering if this is realistic.  Web development is a 
> new
> area for me so bare with me please if this is a laughable question.  I
> uploaded a 1GB file and it was uploaded and moved to a folder in my 
> project
> in a matter of a few seconds.
>
> def simple_upload(request):
> if request.method =='POST' and request.FILES['myfile']:
> myfile = request.FILES['myfile']
> fs = FileSystemStorage()
> filename = fs.save(myfile.name, myfile)
> uploaded_file_url = fs.url(filename)
> return render(request, 'simple_upload.html', {
> 'uploaded_file_url': uploaded_file_url
> })
>
> return render(request, 'simple_upload.html')
>
> {% load static %}
>
> {% block content %}
>   
> {% csrf_token %}
> 
> Upload
>   
>
>   {% if uploaded_file_url %}
> File uploaded at: {{
> uploaded_file_url }}
>   {% endif %}
>
>   Return to home
> {% endblock %}
>
> 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...@googlegroups.com.
> To post to t

Test runner returning error with multi file models

2017-09-26 Thread Jezeniel Zapanta
I have an app with multi-file models

myapp/
   |- models/
   |- __init__,py
   |- user.py


When I am running python manage.py test it returns:

RuntimeError: Conflicting 'user_groups' models in application...

But when I use only a single `models.py` file it works. Is this a bug? or 
am i doing something wrong?

-- 
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/90cafba5-8b28-4df0-86f2-97302e4a2c56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding data via admin not visible on html template until restart server (python manage.py runserver)

2017-09-26 Thread cnn . marketing
Any update on this?

I have the similar issue - I login to my demo Django 
http://127.0.0.1:8000/admin/, and update a field name 'name' in 'demo'. The 
field 'name' is still showing the old data by using url (restful api) 
http://127.0.0.1:8000/demo. I have to use http://127.0.0.1:8000/admin/demo 
(notice the 'admin') in order to see the updated 'name'.



On Tuesday, September 19, 2017 at 9:42:59 AM UTC-4, avtar sandhu wrote:
>
> Please can anyone help me
>
>
> I have a Django Model
>
> class Event(models.Model): scheduled_event = 
> models.BooleanField(default=True) category = models.CharField("category ", 
> max_length = 30)
>
> registered in admin
>
> class PostEvent(admin.ModelAdmin): admin.site.register(Event, PostEvent)
>
> I can add delete etc ok in Admin
>
> However the data is not refreshed in my html template until i restart the 
> server
>
> python manage.py runserver
>
>
> How can i make the changes dynamic.  dont want to restart the server 
> anytime a user makes some content change 
>
>
> All help would be appreciated 
>

-- 
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/77e49697-ac2f-4552-9128-cde8ea603e54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error when running tests while using multi-file models

2017-09-26 Thread Jezeniel Zapanta
I am using multi-file models on my app:

Example file structure:

app/
|- models/
|- __init__.py
|- user.py


When I run `python manage.py test` it returns:

RuntimeError: Conflicting 'user_groups' models in application...

But when I join then into one file (models.py) it works? Am I doing 
something wrong?

-- 
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/70ac450c-ad4c-4b0e-acbe-3d94bb1cf5a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Updating data via admin not visible on restful api without admin specified in url until restart server

2017-09-26 Thread cnn . marketing

After login to my account via http://127.0.0.1:8000/admin, I update the 
data in field 'name' for 'demo'. I can see the updated data for 'name' by 
using http://127.0.0.1:8000/admin/demo. However, the field 'name' is 
showing the old data via url (restful api) http://127.0.0.1:8000/demo 
(NOTICE, no 'admin' in the url) until I manually restart the server via 
'python manage.py runserver'.

Is this a known issue?

-- 
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/75a7bc85-5520-4ff9-a846-fde426b72927%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating data via admin not visible on restful api without admin specified in url until restart server

2017-09-26 Thread Xavier Ordoquy
Hi,

You likely have an issue with scope in your code. Something similar to 
https://stackoverflow.com/questions/15395521/django-form-field-will-not-update-without-server-reset-instantiating-a-clas
 

 for example.

Regards,


> Le 26 sept. 2017 à 21:42, cnn.market...@gmail.com a écrit :
> 
> 
> After login to my account via http://127.0.0.1:8000/admin, I update the data 
> in field 'name' for 'demo'. I can see the updated data for 'name' by using 
> http://127.0.0.1:8000/admin/demo. However, the field 'name' is showing the 
> old data via url (restful api) http://127.0.0.1:8000/demo (NOTICE, no 'admin' 
> in the url) until I manually restart the server via 'python manage.py 
> runserver'.
> 
> Is this a known issue?
> 
> -- 
> 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/75a7bc85-5520-4ff9-a846-fde426b72927%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/FE0B581F-DA2D-48F5-BFEE-C8636AA744B6%40linovia.com.
For more options, visit https://groups.google.com/d/optout.