Re: Django forms validation

2016-05-06 Thread Babatunde Akinyanmi
Good morning Lekan. My response is inline...
On May 6, 2016 4:21 AM, "Lekan Wahab"  wrote:
>
> Hello Babatunde,
> Thank you for answering my question.
> I have actually done that.
> But Django throws and error whenever I I instantiate form/for_class to
ContactForm(request. POST).
> It says it's expected only a single argumen. but two was provided.
>
That means you defined your form class without any arguments. I've looked
at your form definition and that's exactly what's happening.

>> >> class ContactForm(forms.ModelForm):
>> >> helper = FormHelper()
>> >> helper.form_tag = False
>> >> def __init__(self):

# __init__ is given only one argument. You didn't supply all the other
arguments needed for the form to work properly.

>> >> super(ContactForm, self).__init__()
>> >> for key in self.fields:
>> >> self.fields[key].required= False
>> >> self.fields[key].label = False
>> >>
>> >>
>> >> class Meta:
>> >> fields = '__all__'
>> >> model =  Contact
> On 05 May 2016 10:36 PM, "Babatunde Akinyanmi" 
wrote:
>>
>> Hello Lekan. I have responded inline but my answer might not be a
complete fix.
>>
>> On May 5, 2016 4:56 PM, "Lekan Wahab"  wrote:
>> >
>> > Hello,
>> > Please, i have a model form in forms.py which am trying to validate
and update my database with. However, for some reason the form is not being
validated. I have tried everything i could think of. It just reloads the
page.
>> >
>> > views.py
>> >>
>> >> from django.shortcuts import render
>> >> from information.forms import ContactForm
>> >> from django.http import HttpResponse, HttpResponseRedirect
>> >>
>> >>
>> >> def index(request):
>> >> form_class = ContactForm
>> >> if request.method == 'POST':
>> >> form = form_class()
>>
>> The above line creates an empty form because you didn't supply anything
as the data argument therefore the is_valid method will never return True.
You need to instantiate it with your POST data. Try:
>>  form = form_class(request.POST)
>> >> if form.is_valid():
>> >> ###Dummy text to check validation
>> >> return  HttpResponse('Done')
>> >> return render(request, 'information/index.html', {'form':
form_class})
>> >>
>>
>> {'form': form_class}
>> form_class is not an object. Perhaps you meant {'form': form}
>> >>
>> >> def complete(request):
>> >> return HttpResponse("Thank you for contacting us")
>> >
>> >
>> > models.py
>> >
>> >>
>> >> from crispy_forms.helper import FormHelper
>> >> from django import forms
>> >> from django.core.exceptions import ValidationError
>> >> from django.forms import Form
>> >> from information.models import Contact
>> >> from crispy_forms.helper import FormHelper
>> >> from crispy_forms.layout import Layout,Fieldset, HTML
>> >> from crispy_forms.bootstrap import TabHolder,Tab
>> >>
>> >>
>> >> class ContactForm(forms.ModelForm):
>> >> helper = FormHelper()
>> >> helper.form_tag = False
>> >> def __init__(self):
>> >> super(ContactForm, self).__init__()
>> >> for key in self.fields:
>> >> self.fields[key].required= False
>> >> self.fields[key].label = False
>> >>
>> >>
>> >> class Meta:
>> >> fields = '__all__'
>> >> model =  Contact
>> >
>> >
>> > Thank you.
>> >
>> > --
>> > 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/CAE6v7oeD7Qb_%2BJrhiOzRTiDJ%3DqEPAY56B86nuxdZnrv2EP%2BrdQ%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/CA%2BWjgXMLEmHKdtAWBA%2BsO7zPD9XGAggUPVXsU5beqg%3Dwb2Ax5Q%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

Re: Connecting to an established MS SQL database

2016-05-06 Thread Larry Martell
On Thu, May 5, 2016 at 3:26 PM, David McDonald  wrote:
> Hello, I am very new to Django and have an idea for an application at work.
>
> We have an already established MS SQL database, that I have a read only user
> for.
>
> Is there any way I can connect to this database and retrieve data from it,
> once I have retrieved it, I would like to connect to another MS SQL database
> and perform some actions on the data so this new database may be queried via
> a website.
>
> Is the above even possible?

There are django-mssql and django_pyodbc but I was never able to get
either of those to work for me. I ended up using odbc - I couldn't use
the ORM, but I still was able to connect to the MSSQL DB from my
django app using raw queries.

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


Re: Fixtures won't load twice in same testcase

2016-05-06 Thread Alasdair Nicol
Hi Rich,

Regarding a couple of things you mentioned on Django-developers:

On Thursday, 5 May 2016 19:20:16 UTC+1, Rich Rauenzahn wrote:
>
>
> Thanks, Tim.
>
> Unfortunately I can't move past Django 1.7 yet -- dependencies.  I've been 
> marching my way up one revision at a time hopefully up to 1.9 as a way to 
> keep the scope of what breaks under control as I move through each major 
> revision and stabilize my project.  Then I attack replacing dependencies.
>
> I really think I've found a bug here ... which I hope to suggest a patch 
> for and submit, hence the post to the developers channel, but I can go back 
> to the users group for now... My recent experience with that list doesn't 
> bode well, however, and I don't have high hopes with anyone there able to 
> respond at the internals level I may need to track down the issue.  I've 
> almost rewritten my tests to just load raw sql, but if there is a bug here 
> I'd like to help find it rather than work around/ignore it.
>

Fixture loading was changed in Django 1.8 [1], so even if you have found a 
bug in Django 1.7, there's a good chance that behaviour will be different 
in Django 1.8 and later.


> But In this particular run I'm currently tracing, rich is already in the 
> db (as the only entry) as pk=5 (via fixture loading process).   For one, 
> this tells me the sequence generators aren't always resetting between 
> fixture loads/tests.
>
>  
Sequences *are not* reset between test cases by default [2]. Perhaps you 
need to change your code so that it doesn't assume that the user has pk=1, 
or set reset_sequences = True.

It's difficult to offer any more advice, because you haven't posted any 
code that can reproduce the problem. It doesn't need to be the actual code, 
in fact the simpler the example is the better.

Cheers,
Alasdair

[1]: https://docs.djangoproject.com/en/1.9/releases/1.8/#testcase-data-setup
[2]: 
https://docs.djangoproject.com/en/1.9/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences

-- 
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/d877ef6b-75d2-4197-85ab-9c0901e7ad95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ubuntu 16.04 Django 1.9.6 & MySql

2016-05-06 Thread Tim Graham
It helps if you tell us the actual errors you encountered. Maybe 
http://stackoverflow.com/questions/36796167/upgraded-to-ubuntu-16-04-now-mysql-python-dependencies-are-broken
 
helps?

On Thursday, May 5, 2016 at 2:21:50 PM UTC-4, Mauro Miotello wrote:
>
> I cannot install mysqlclient on this env
> many errors
>
> is there a right path ?
>
> thanks
>
> MM
>

-- 
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/d36df591-045a-4de9-a958-235d4082441d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


python - handling HTTP requests asynchronously

2016-05-06 Thread luke lukes
Hi everyone, 
I need to generate a PDF report for each entry of a django queryset. 
There'll be between between 30k and 40k entries. 

The PDF is generated through an external API. Since currently is generated 
on demand, this is handled synchronously via an HTTP request/response. That 
will be different for this task, since I think I'll use a django management 
command to loop through the queryset and perform the PDF generation. 

Which approach should I follow for this task? I thought about 3 possibile 
solutions, although are technologies that I never used: 

1) Celery 
: 
assign a task (http request with a different payload) to a worker, then 
retrieve it once it's done;

2) request-futures : using 
requests in a non-blocking way;

3) multiprocessing  
package, e.g. assigning a Pool of workers. 


the goal is to use the API concurrently (e.g. send 10 or 100 http requests 
simultaneously, depending on how many concurrent requests the API can 
handle). 

the project runs on Python 2.7 and this task will occur approximately once 
a year.


Anybody here that handled a similar task and can give advices on how to 
proceed on this? 

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


Re: How to access selected options from a select list to show them in a table ?

2016-05-06 Thread Ricardo Daniel Quiroga
Hello,
What you must do is to use Javascript and AJAX, to have the desired
behavior, I guess would be for onchange event. By the way it is therefore
desirable to handle the tables in the following format


   

   
   
   


regards

2016-05-03 8:06 GMT-03:00 :

> So i have a select list and a table,and i want to show only the data that
> corresponds the selected item.
>
> This is my index.html file
>
> 
> Owners
> ---
> {% for owner in owners %}
>  {{ owner.person_id }} {{ owner.first_name }} 
> {{ owner.last_name }}
> {% endfor %}
> 
>  
> 
> 
> Id
> Space
> City
> Street
> Price
> Purpose
> 
>
>
> {% for info in information %}
>
> 
> {{ info.owner_id }}
> {{ info.space }}
> {{ info.city }}
> {{ info.street }}
> {{ info.price }}
> {{ info.get_purpose }}
> {% endfor %}
>
> 
>
> 
>
> --
> 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/e3502e4e-c58b-46e7-8201-9b07edcca7dc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Ricardo Daniel Quiroga

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


Django Models

2016-05-06 Thread Omar
Gretting, I have in my DataBase (Directorios) two row, Departamento and
Telefonos with the method Directorios.objects.all() I can get all objects in
my DB but I need just get all Departamento in a variable, I don't know how
get it separated. 



--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

-- 
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/001a01d1a7a3%246b23ef40%24416bcdc0%24%40infomed.sld.cu.
For more options, visit https://groups.google.com/d/optout.


Re: Django Models

2016-05-06 Thread Sergiy Khohlov
 simplest way is using  filter() against all()
Take a look at
https://docs.djangoproject.com/en/1.9/ref/models/querysets/

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Fri, May 6, 2016 at 5:27 PM, Omar  wrote:

> Gretting, I have in my DataBase (Directorios) two row, Departamento and
> Telefonos with the method Directorios.objects.all() I can get all objects
> in my DB but I need just get all Departamento in a variable, I don’t know
> how get it separated.
>
> --
> 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/001a01d1a7a3%246b23ef40%24416bcdc0%24%40infomed.sld.cu
> 
> .
> 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/CADTRxJNVNQE-M-Agy9Ca3iJyA5fTBeOU%3DetV9K7dd%2BzhhMVG1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


multiple INSERT with django form

2016-05-06 Thread tholtorff
Hi

I'm trying to create a django form based on the model. The model contains 
fields: username, date, shift, department, team. Team and Department are 
defined in different app and are extending the user through UserProfile. I 
would like to have a table that is generated automatically based on the 
number of days in the month and users from department and look more less 
like that:

x | Day1   | Day2   | Day3   | ... | Day31   |
--
User1 | Shift1 | Shift2 | Shift3 | ... | Shift31 |
--
User2 | Shift1 | Shift2 | Shift3 | ... | Shift31 |
--
User3 | Shift1 | Shift2 | Shift3 | ... | Shift31 |

where user (is a private key of another table) and day values will be added 
during the generation of the table and shift will be the dropdown box.

INSERT to the database should be constructed for each day (user1, day1, 
shift1, department, team) where department and team should be taken 
automatically based on the username from UserProfile.

I do not know where to start. I've looked at django formset and it would 
seem a way to go but the formset is generating a HTML table code and all 
fields are from the form would be in the table. Additionally I would like 
the possibility to change the generated table within the same view.

I would be very grateful if you can point me to the documents that might 
help me.

Cheers,
Tom

-- 
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/acc6cbf4-9484-4dc7-a1ac-bd9b205d651b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Passing hidden foreign key to form as initial value

2016-05-06 Thread Michel Z. Santello
Can somebody explain why did occurs with widget=forms.HiddenInput ?

Thank's.




Em quarta-feira, 31 de março de 2010 10:20:48 UTC-3, Phoebe Bright escreveu:
>
> Displayed fields resolve as expected, hidden fields cause errors.
>
> This works:
>
> in the model
> CourseBook has a foreign key to Course
>
> In the view:
>
> course = Course.objects.get(pk=whatever)
> form = CouseBook(initial = {'course': course})
>
>
> in the Form:
>
> class CourseBook(ModelForm):
> class Meta:
> model = CourseBooking
>
>
> The web page now displays a picklist of courses with the initial value
> highlighted.  I can now do a form.save() no problem.
>
> However, if I make the course a hidden field, which is what I want.
>
> class CourseBook(ModelForm):
> course = forms.CharField(widget=forms.HiddenInput())
>
> class Meta:
> model = CourseBooking
>
> then when I come to save() I get a ValueError, unable to assign "My
> course"  etc. as it tries to put the name of the course into the
> foreign key instead of a course instance.
>
> I can work around this putting a save method on the form, but it seems
> to me django should resolve this for me
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3628bd01-59b2-4291-94f5-072d6de9f7c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django rest framework-haystack-elasticsearch

2016-05-06 Thread keba . diedhiou
Hello i have a problem with django rest 
framework-haystack-elasticsearch.when i execute 
http://example.com/api/v1/location/search/?city=Oslo i have a problem: "The 
model None is not registered"

-- 
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/6afb6d0e-78ce-4cfe-a9f6-eacdd6e189bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Having a problem loading images and other content for some reason..

2016-05-06 Thread Yakir Gabay
Hello I'm very new to Django and very confused
I have basic familiarity with HTML.
Hosted a website on my localhost, the CSS loads like I wanted however the 
images refuse to load and the menu doesn't respond to anything like it 
should..
Very lost and appreciate any help..



  

{% load staticfiles %}



amwa


{% load staticfiles %}



https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css";>




  
  





Toggle navigation








Home
About

Themes

Admin & Dashboard
Admin 1
Admin 2

Portfolio
Portfolio 1
Portfolio 2


Contact



 
{% block content %}
{% endblock %} 



amwa.com copyright 2016.









https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js";>


  


-- 
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/e263c7c8-4b7f-4f46-9605-9eada590dcf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Storing images in a database using Django.

2016-05-06 Thread Mlati Mudan

Hi guys, I'm a TOTAL noob when it comes to django and web development for 
that matter. I have an idea for a web app and I do have a basic 
understanding of programming. I've gone through a few Django tutorials and 
I'm confident I can do it, I just need help along the way :) 

So, my "brilliant" idea is to make an app for cooking for dummies. 
Basically, I'd have a repository of recipes. Each recipe consists of: 
recipe_ID, name, and 10 instruction-photo pairs ("now do this" + photo of 
that).

The photos are relatively lightweight (less than 50k each) so I think 
storing them in a database is the way to go. The only snag - I have 
absolutely no idea how to do it. I've googled a lot but I'm either too 
thick or my needs are too specific. 

I don't actually need to be able to store the images in the database 
through the web app. I was thinking of creating folders that contain the 
pertinent photos and "somehow" storing them in the database for further 
use. The name of the folder would be the same as the recipe_ID, and the 
photos would be named recipe_ID_01.jpg, recipe_ID_02.jpg, ...

Thanks in advance for any help you can give me :) 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24fb47fd-573c-44da-b232-75efad0da79f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing images in a database using Django.

2016-05-06 Thread André Machado
NEVER store images in DB, store its path so you can use it in a img tag 
later. =)

Em sexta-feira, 6 de maio de 2016 16:06:08 UTC-3, Mlati Mudan escreveu:
>
>
> Hi guys, I'm a TOTAL noob when it comes to django and web development for 
> that matter. I have an idea for a web app and I do have a basic 
> understanding of programming. I've gone through a few Django tutorials and 
> I'm confident I can do it, I just need help along the way :) 
>
> So, my "brilliant" idea is to make an app for cooking for dummies. 
> Basically, I'd have a repository of recipes. Each recipe consists of: 
> recipe_ID, name, and 10 instruction-photo pairs ("now do this" + photo of 
> that).
>
> The photos are relatively lightweight (less than 50k each) so I think 
> storing them in a database is the way to go. The only snag - I have 
> absolutely no idea how to do it. I've googled a lot but I'm either too 
> thick or my needs are too specific. 
>
> I don't actually need to be able to store the images in the database 
> through the web app. I was thinking of creating folders that contain the 
> pertinent photos and "somehow" storing them in the database for further 
> use. The name of the folder would be the same as the recipe_ID, and the 
> photos would be named recipe_ID_01.jpg, recipe_ID_02.jpg, ...
>
> Thanks in advance for any help you can give me :) 
>
>

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


Django-Dashing

2016-05-06 Thread Foridur Kayes Shawon
I am trying to work with django-dashing but some thing is going wrong. 
Please give me some direction that would actually work.

-- 
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/6718af5d-1f9e-4550-86fc-443bbc6be6a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-Dashing

2016-05-06 Thread Aaron C. de Bruyn
Can you provide us with a little more detail?  What isn't working?  What
error messages are you getting?

I haven't touched it in about a year.  You might also consider getting
support by going here: https://github.com/talpor/django-dashing/issues/new

-A

On Fri, May 6, 2016 at 12:51 PM, Foridur Kayes Shawon <
shawon.ka...@gmail.com> wrote:

> I am trying to work with django-dashing but some thing is going wrong.
> Please give me some direction that would actually work.
>
> --
> 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/6718af5d-1f9e-4550-86fc-443bbc6be6a4%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/CAEE%2BrGpz17C0KBSyCS0uoyvAZ2V7bzBQ0_dt3umCZjjrZL%3Drsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing images in a database using Django.

2016-05-06 Thread Alex Heyden
There's an ImageField for use in models, but to really understand it, start
with FileField

https://docs.djangoproject.com/en/1.9/topics/files/
https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.FileField

The general idea is that you have a directory configured by Django's
settings that you can use to hold uploaded files. You can also use Django
to serve these files if you want. (I tend to use nginx directly for this
for performance reasons, but you do what works for you.)

I wouldn't go so far as to say that there's no use case for storing images
in databases, but in general, André's advice is solid: store the path
instead. Your OS is good at managing files. Let it do its job.

On Fri, May 6, 2016 at 2:53 PM, André Machado 
wrote:

> NEVER store images in DB, store its path so you can use it in a img tag
> later. =)
>
> Em sexta-feira, 6 de maio de 2016 16:06:08 UTC-3, Mlati Mudan escreveu:
>>
>>
>> Hi guys, I'm a TOTAL noob when it comes to django and web development for
>> that matter. I have an idea for a web app and I do have a basic
>> understanding of programming. I've gone through a few Django tutorials and
>> I'm confident I can do it, I just need help along the way :)
>>
>> So, my "brilliant" idea is to make an app for cooking for dummies.
>> Basically, I'd have a repository of recipes. Each recipe consists of:
>> recipe_ID, name, and 10 instruction-photo pairs ("now do this" + photo of
>> that).
>>
>> The photos are relatively lightweight (less than 50k each) so I think
>> storing them in a database is the way to go. The only snag - I have
>> absolutely no idea how to do it. I've googled a lot but I'm either too
>> thick or my needs are too specific.
>>
>> I don't actually need to be able to store the images in the database
>> through the web app. I was thinking of creating folders that contain the
>> pertinent photos and "somehow" storing them in the database for further
>> use. The name of the folder would be the same as the recipe_ID, and the
>> photos would be named recipe_ID_01.jpg, recipe_ID_02.jpg, ...
>>
>> Thanks in advance for any help you can give me :)
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5dcad641-8837-477c-8a43-e7328c11850e%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/CA%2Bv0ZYW%2Bb0di3f9T3isNp5zjQo7_aqaa%2BkC%3DsvuFu5_AWSm8PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django formset security and injecting PKs in formset hidden id fields

2016-05-06 Thread Carl Meyer
Hi Rob,

On 05/03/2016 12:23 PM, Rob Ladd wrote:
> I've noticed something troubling in Django formsets:
> 
> Each formset.form has a hidden field with the id of the model being edited. 
> 
> All one would need to do is change this id and submit, and the default
> formset |clean()| or |save()| methods don't bat an eye.

First of all, if you believe that you've found a security issue in
Django, please err on the side of caution and email
secur...@djangoproject.com, rather than reporting it in public. Thanks!

Second: can you provide a sample project demonstrating the behavior you
describe? I'm unable to reproduce that behavior, and by code inspection
I don't see how that behavior could occur, either. If you pass in the
`queryset` keyword argument when instantiating the formset, only objects
matching that queryset will be editable via the formset. Meddling with
IDs will at best allow you to create a new object, never to edit one
that's outside of `queryset`. But formsets always allow creation of new
objects.

It is true that the given queryset could match some new object on submit
that wasn't part of the queryset when the formset was initially
displayed, if that object was created or edited such that it now matches
the queryset filters in the meantime. There isn't any reasonable way for
Django to address this problem: there isn't necessarily any location
available to store state in between display and submit other than the
page, and that's under the control of the user. You should just be sure
that the filters applied to the `queryset` accurately describe the
limitations you want applied to the editing abilities of the user being
shown the formset. In a typical use case, the `queryset` would apply a
filter like `(owner=request.user)`, allowing a user to edit only the
objects they own.

If you still believe you're seeing a security issue here, please email
secur...@djangoproject.com with step by step reproduction instructions.

Thanks,

Carl

-- 
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/572D253C.4070301%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Django formset hidden id field

2016-05-06 Thread Carl Meyer
Hi Rob,

On 05/03/2016 12:13 PM, Rob Ladd wrote:
> Carl Meyer said:
> 
> "Whatever queryset you pass to the model formset limits the 
> available rows for editing. The end user can edit the PK to refer to any 
> item in that queryset, but not any item in the table. "
> 
> That's not true, based on my observation. 
> As long as the PK refers to any object of that type, it can be edited by
> monkeying with the hidden id field.

I replied to this in the other thread you started:
https://groups.google.com/d/topic/django-users/tJpKWbij1B0/discussion

Short version, I can't reproduce the behavior you describe.

Carl

-- 
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/572D2673.2010800%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Storing images in a database using Django.

2016-05-06 Thread Adam Stein
You can take a look at django-db-file-storage
https://readthedocs.org/projects/django-db-file-storage/
In my case, I was making something for myself and the hosting server
doesn't allow me access to any kind of file system, so I found this.
On Fri, 2016-05-06 at 15:42 -0500, Alex Heyden wrote:
> There's an ImageField for use in models, but to really understand it,
> start with FileField
> 
> https://docs.djangoproject.com/en/1.9/topics/files/
> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.mo
> dels.FileField
> 
> The general idea is that you have a directory configured by Django's
> settings that you can use to hold uploaded files. You can also use
> Django to serve these files if you want. (I tend to use nginx
> directly for this for performance reasons, but you do what works for
> you.)
> 
> I wouldn't go so far as to say that there's no use case for storing
> images in databases, but in general, André's advice is solid: store
> the path instead. Your OS is good at managing files. Let it do its
> job.
> 
> On Fri, May 6, 2016 at 2:53 PM, André Machado 
> com> wrote:
> > NEVER store images in DB, store its path so you can use it in a img
> > tag later. =)
> > 
> > > 
> > > Hi guys, I'm a TOTAL noob when it comes to django and web
> > > development for that matter. I have an idea for a web app and I
> > > do have a basic understanding of programming. I've gone through a
> > > few Django tutorials and I'm confident I can do it, I just need
> > > help along the way :) 
> > > 
> > > So, my "brilliant" idea is to make an app for cooking for
> > > dummies. Basically, I'd have a repository of recipes. Each recipe
> > > consists of: recipe_ID, name, and 10 instruction-photo pairs
> > > ("now do this" + photo of that).
> > > 
> > > The photos are relatively lightweight (less than 50k each) so I
> > > think storing them in a database is the way to go. The only snag
> > > - I have absolutely no idea how to do it. I've googled a lot but
> > > I'm either too thick or my needs are too specific. 
> > > 
> > > I don't actually need to be able to store the images in the
> > > database through the web app. I was thinking of creating folders
> > > that contain the pertinent photos and "somehow" storing them in
> > > the database for further use. The name of the folder would be the
> > > same as the recipe_ID, and the photos would be named
> > > recipe_ID_01.jpg, recipe_ID_02.jpg, ...
> > > 
> > > Thanks in advance for any help you can give me :) 
> > > 
> > > 
-- 
Adam (a...@csh.rit.edu)


-- 
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/1462577175.4828.32.camel%40csh.rit.edu.
For more options, visit https://groups.google.com/d/optout.


Re: Storing images in a database using Django.

2016-05-06 Thread m1chael
Storing images in a database will be loads of headache later. Like someone
else said: store only the paths! Use FileField/imagefield
On May 6, 2016 7:26 PM, "Adam Stein"  wrote:

> You can take a look at django-db-file-storage
>
> https://readthedocs.org/projects/django-db-file-storage/
>
> In my case, I was making something for myself and the hosting server
> doesn't allow me access to any kind of file system, so I found this.
>
> On Fri, 2016-05-06 at 15:42 -0500, Alex Heyden wrote:
>
> There's an ImageField for use in models, but to really understand it,
> start with FileField
>
> https://docs.djangoproject.com/en/1.9/topics/files/
>
> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.FileField
>
> The general idea is that you have a directory configured by Django's
> settings that you can use to hold uploaded files. You can also use Django
> to serve these files if you want. (I tend to use nginx directly for this
> for performance reasons, but you do what works for you.)
>
> I wouldn't go so far as to say that there's no use case for storing images
> in databases, but in general, André's advice is solid: store the path
> instead. Your OS is good at managing files. Let it do its job.
>
> On Fri, May 6, 2016 at 2:53 PM, André Machado 
> wrote:
>
> NEVER store images in DB, store its path so you can use it in a img tag
> later. =)
>
> Em sexta-feira, 6 de maio de 2016 16:06:08 UTC-3, Mlati Mudan escreveu:
>
>
> Hi guys, I'm a TOTAL noob when it comes to django and web development for
> that matter. I have an idea for a web app and I do have a basic
> understanding of programming. I've gone through a few Django tutorials and
> I'm confident I can do it, I just need help along the way :)
>
> So, my "brilliant" idea is to make an app for cooking for dummies.
> Basically, I'd have a repository of recipes. Each recipe consists of:
> recipe_ID, name, and 10 instruction-photo pairs ("now do this" + photo of
> that).
>
> The photos are relatively lightweight (less than 50k each) so I think
> storing them in a database is the way to go. The only snag - I have
> absolutely no idea how to do it. I've googled a lot but I'm either too
> thick or my needs are too specific.
>
> I don't actually need to be able to store the images in the database
> through the web app. I was thinking of creating folders that contain the
> pertinent photos and "somehow" storing them in the database for further
> use. The name of the folder would be the same as the recipe_ID, and the
> photos would be named recipe_ID_01.jpg, recipe_ID_02.jpg, ...
>
> Thanks in advance for any help you can give me :)
>
>
>
> --
> Adam (a...@csh.rit.edu)
>
>
> --
> 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/1462577175.4828.32.camel%40csh.rit.edu
> 
> .
> 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/CAAuoY6OGTohaj%3Dz4HOB4WLNvTdAyK%3DDBajNN2j2kfz1%3DNEj%2Bmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing images in a database using Django.

2016-05-06 Thread Gabriel Marcondes
If you can't store upload files on your file system (for example, if you
deploy to Heroku), you can use something like django-storages [0] to upload
them to a S3 bucket. S3 is cheap (you can start with a free trial, and
after that you'll pay like 1 or 2 cents/month for small projects) and
reliable.

[0] https://github.com/jschneier/django-storages

On Fri, May 6, 2016 at 11:34 PM, m1chael  wrote:

> Storing images in a database will be loads of headache later. Like someone
> else said: store only the paths! Use FileField/imagefield
> On May 6, 2016 7:26 PM, "Adam Stein"  wrote:
>
>> You can take a look at django-db-file-storage
>>
>> https://readthedocs.org/projects/django-db-file-storage/
>>
>> In my case, I was making something for myself and the hosting server
>> doesn't allow me access to any kind of file system, so I found this.
>>
>> On Fri, 2016-05-06 at 15:42 -0500, Alex Heyden wrote:
>>
>> There's an ImageField for use in models, but to really understand it,
>> start with FileField
>>
>> https://docs.djangoproject.com/en/1.9/topics/files/
>>
>> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.FileField
>>
>> The general idea is that you have a directory configured by Django's
>> settings that you can use to hold uploaded files. You can also use Django
>> to serve these files if you want. (I tend to use nginx directly for this
>> for performance reasons, but you do what works for you.)
>>
>> I wouldn't go so far as to say that there's no use case for storing
>> images in databases, but in general, André's advice is solid: store the
>> path instead. Your OS is good at managing files. Let it do its job.
>>
>> On Fri, May 6, 2016 at 2:53 PM, André Machado 
>> wrote:
>>
>> NEVER store images in DB, store its path so you can use it in a img tag
>> later. =)
>>
>> Em sexta-feira, 6 de maio de 2016 16:06:08 UTC-3, Mlati Mudan escreveu:
>>
>>
>> Hi guys, I'm a TOTAL noob when it comes to django and web development for
>> that matter. I have an idea for a web app and I do have a basic
>> understanding of programming. I've gone through a few Django tutorials and
>> I'm confident I can do it, I just need help along the way :)
>>
>> So, my "brilliant" idea is to make an app for cooking for dummies.
>> Basically, I'd have a repository of recipes. Each recipe consists of:
>> recipe_ID, name, and 10 instruction-photo pairs ("now do this" + photo of
>> that).
>>
>> The photos are relatively lightweight (less than 50k each) so I think
>> storing them in a database is the way to go. The only snag - I have
>> absolutely no idea how to do it. I've googled a lot but I'm either too
>> thick or my needs are too specific.
>>
>> I don't actually need to be able to store the images in the database
>> through the web app. I was thinking of creating folders that contain the
>> pertinent photos and "somehow" storing them in the database for further
>> use. The name of the folder would be the same as the recipe_ID, and the
>> photos would be named recipe_ID_01.jpg, recipe_ID_02.jpg, ...
>>
>> Thanks in advance for any help you can give me :)
>>
>>
>>
>> --
>> Adam (a...@csh.rit.edu)
>>
>>
>> --
>> 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/1462577175.4828.32.camel%40csh.rit.edu
>> 
>> .
>> 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/CAAuoY6OGTohaj%3Dz4HOB4WLNvTdAyK%3DDBajNN2j2kfz1%3DNEj%2Bmg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
---
Gabriel Marcondes
Engenheiro de Computação - UFSCar

-- 
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