Re: How do I start with this project with django

2014-03-14 Thread mulianto
Hi Rob,

For storing uploaded user files, you should put it in media folder, not static 
folder. Static for your app file like css/js/images.

Of course you have to protect the file can be uploaded, in your view you can 
check the extension of file you allow.

Regards 

Mulianto
B : Http://muliantophang.blogspot.com

Sent from my iPhone

On 14 Mar 2014, at 14:22, Rob L  wrote:

> Hi, 
> 
> I hope this is a right place to ask, not very sure where to post on internet.
> It's about planning a django project, maybe a similar django package has been 
> already there, if it's true, I hope someone can tell me which it is.
> 
> The feature list of the project I am wishing to do is:
> Let users upload some images(a folder contains image files)
> Backend generates static htmls to present those images, basically as a 
> gallery, via an generated url
> User can select from default themes(templates)
> The template I am talking about here is not django template, they are a bunch 
> of xhtml, css and js files can be choose from default or uploaded by user. 
> User can upload and use their customized templates
> I made a local Python program that can work for the purpose here: 
> https://github.com/viewplatgh/pgal, maybe can help you understand the feature 
> I am trying to implement on the django project
> The workflow is quite similar to http://codepen.io, but what user inputs are 
> images, optionally templates, css and js files, rather than html file itself. 
> The htmls are generated by django app, and create a short url for people who 
> uploaded/built their resources to view the gallery.
> I know this app don't have to be implemented by using django. I choose django 
> because Python is the language I'm familiar with and it's the framework I 
> have a little experience with, but to implement such a site I have so many 
> questions and don't know where to start. I don't expect an exact answer to 
> this post, but just hope to collect more helpful information, resources and 
> ideas from experienced programmers to help me kick my project off...
> 
> Here is some questions in my mind currently:
> Would django allow me to write a bunch of files at backend? 
> Unlike php, django's urls don't map to server's folders. But I need that 
> feature to let user view the generated statics. How do I work through this. 
> Should I generate django templates?
> How to prevent user from uploading malicious stuff to backend...
> Any suggestions, ideas would be appreciated. Thanks! 
> 
> Thanks
> Rob L
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/10a15408-3025-4e97-8276-f2ca8a17fbb6%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/73713600-9FE9-458C-A547-3FCD1A46BCFB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Russell Keith-Magee
On Sat, Mar 15, 2014 at 7:19 AM, Jonathan Baker <
jonathandavidba...@gmail.com> wrote:

> Does that mean that the default="" functionality is implemented by the
> ORM, instead of in the database layer?
>
> This is correct - Django's "default" argument is an API level default, not
a database level default.

Yours,
Russ Magee %-)

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq848ZhoEOdt%3DkEu_5dGiqVHWjNakemjrTGAk%2B3dKr7qZBUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [newbie] -- Regex-matching ("Tango with Django")

2014-03-14 Thread Shawn Milochik
You're meant to only have one include that redirects URLs beginning with
rango to the app's urls.py.

Then, the app's urls.py must not have /rango in the URLs. The idea is that
all URLs starting with "rango" get the "rango" stripped off and passed to
the rango app, which itself has / and /about.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzwKwEkFqGBaxQQ76oce1zdKQDDWD8MnBdhKjzvrWegOJYoWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[newbie] -- Regex-matching ("Tango with Django")

2014-03-14 Thread David
Dear list,

I am wodering whether my implementation is incorrect or whether there is
a typo in the textbook. My question is how I can make sense of these
instructions: "The regular expression to match about/ is r'^about/'".

I was following the "Tango with Django" book.

In the exercises of chapter 3 I am asked to

"""
Now map the view ['about', which we just created] to /rango/about/. For
this step, you’ll only need to edit the urls.py of the rango application.
"""

Later, the author gives some hints, specifically:


"""
The regular expression to match about/ is r'^about/'
"""

Now, there was no way to do this. I finally managed to get

http://127.0.0.1:8000/rango/and
http://127.0.0.1:8000/rango/about/

running satisfactorily (my code is below), but I was not even sure this
was intended. The author possibly wanted to create

http://127.0.0.1:8000/about/instead of
http://127.0.0.1:8000/rango/about/

Thanks for clarifying this issue for me!

Cheers,

David




Here is my project/urls.py

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'justnow.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

# url(r'^admin/', include(admin.site.urls)),
url(r'^rango/', include('rango.urls')),  # ADD THIS NEW TUPLE!
url(r'^about/', include('rango.urls')),  # ADD THIS NEW TUPLE!
)



The app urls.py:

from django.conf.urls import patterns, include, url
from rango import views

urlpatterns = patterns('',
url(r'^$', views.index, name='Rangos index'),
url(r'about', views.about, name='About page'),
)

The app views.py:

from django.http import HttpResponse

def index(request):
return HttpResponse("Rango says hello. About")

def about(request):
return HttpResponse("Here is the about page. Index")







david@ubuntu:~/[...]/django_project$ tree
.
├── manage.py
├── notes.txt
├── rango
│   ├── admin.py
│   ├── admin.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── urls.py
│   ├── urls.pyc
│   ├── views.py
│   └── views.pyc
└── tango_with_django_project
├── __init__.py
├── __init__.pyc
├── settings.py
├── settings.pyc
├── urls.py
├── urls.pyc
├── wsgi.py
└── wsgi.pyc

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5323A289.9000503%40gmx.net.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Craig Schmidt
On Mar 14, 2014, at 7:24 PM, Shawn Milochik  wrote:

> On Fri, Mar 14, 2014 at 7:19 PM, Jonathan Baker 
>  wrote:
> Does that mean that the default="" functionality is implemented by the ORM, 
> instead of in the database layer?
> 
> 
> Perhaps I'm wrong -- I'm looking at my South migrations and they do pass the 
> defaults. I believe that, either way, if you only touch the database through 
> the ORM it'll be set properly. It probably depends on what database you're 
> using.
> 
> However, there's a bigger issue -- if you run syncdb a second time, it will 
> do nothing, so it doesn't matter either way. If you want to modify an 
> existing table you need to use South (or do it manually). Syncdb will not 
> touch existing tables -- it only adds new ones. Or you can wipe out your 
> whole database and then run syncdb, that would fix it if you don't care about 
> your data.

In my case, it is for a system that isn't in production yet, so I was planning 
to wipe the database before running syncdb.  I just didn't know if that is 
necessary.

-Craig


> 
> Shawn 
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAOzwKwHmO%3D3T9BvRU6c1OL6G7HbR-At0pbn5-V47Nb-fLrs-kQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/B823C8A7-120E-4ADC-A99B-811C64E9D8D6%40craigschmidt.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Shawn Milochik
On Fri, Mar 14, 2014 at 7:19 PM, Jonathan Baker <
jonathandavidba...@gmail.com> wrote:

> Does that mean that the default="" functionality is implemented by the
> ORM, instead of in the database layer?
>
>
Perhaps I'm wrong -- I'm looking at my South migrations and they do pass
the defaults. I believe that, either way, if you only touch the database
through the ORM it'll be set properly. It probably depends on what database
you're using.

However, there's a bigger issue -- if you run syncdb a second time, it will
do nothing, so it doesn't matter either way. If you want to modify an
existing table you need to use South (or do it manually). Syncdb will not
touch existing tables -- it only adds new ones. Or you can wipe out your
whole database and then run syncdb, that would fix it if you don't care
about your data.

Shawn

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzwKwHmO%3D3T9BvRU6c1OL6G7HbR-At0pbn5-V47Nb-fLrs-kQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Jonathan Baker
Does that mean that the default="" functionality is implemented by the ORM,
instead of in the database layer?


On Fri, Mar 14, 2014 at 5:16 PM, Shawn Milochik wrote:

> No, no syncdb required. The default applies to newly-created instances,
> not existing ones.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOzwKwH-5UNR7ajWb%2B-w%3DepQRSUooEk%3DA-gwAjAhE8vtUT%3DA_Q%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPMFOb7Go_gbCZFJVE4T5Mt4t8D3F1w-g5%2BfGKnRuQkgqGdvnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Shawn Milochik
No, no syncdb required. The default applies to newly-created instances, not
existing ones.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzwKwH-5UNR7ajWb%2B-w%3DepQRSUooEk%3DA-gwAjAhE8vtUT%3DA_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: messaging

2014-03-14 Thread François Schiettecatte
Sending text has nothing to do with Django, just search for 'sending text 
message from email' in your favorite search engine.

François

On Mar 14, 2014, at 4:32 PM, Ankit Singh  wrote:

> i want to know that for certain task i want to send some message to user on 
> his cellphone .
> is there any way that i can do so in django with importing costly application.
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/eb626e06-f98c-4167-a8c4-a70f52fada40%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Craig Schmidt
This is probably an easy question, but I didn't manage to find the answer.

If I just change the default value of a field in a model, do I need to run 
syncdb?

Specifically I changed:

foo = models.IntegerField(default=1)

to

foo = models.IntegerField(default=5)

Thanks,
Craig

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1E74D9D7-51D1-4EF3-9772-3E54CC652B97%40craigschmidt.com.
For more options, visit https://groups.google.com/d/optout.


messaging

2014-03-14 Thread Ankit Singh
i want to know that for certain task i want to send some message to user on 
his cellphone .
is there any way that i can do so in django with importing costly 
application.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb626e06-f98c-4167-a8c4-a70f52fada40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can please someone explain this code from the docs?

2014-03-14 Thread voger

On 03/14/2014 11:49 PM, Shawn Milochik wrote:

That's just the syntax for calling a method on the base class.

1. MultiEmailField is a subclass of forms.Field.
2. forms.Field has a method named validate.
3. MultiEmailField also has a method named validate, so it overrides the
one on forms.Field.



Thank you. It seemed odd that the calling class name is used to call the 
parent but the more I think about it the more it makes sense. super in 
it self is a function that returns the parent of a given class. So it is 
logical to include class in arguments list.


--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53237CB9.4080105%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: Can please someone explain this code from the docs?

2014-03-14 Thread Shawn Milochik
That's just the syntax for calling a method on the base class.

1. MultiEmailField is a subclass of forms.Field.
2. forms.Field has a method named validate.
3. MultiEmailField also has a method named validate, so it overrides the
one on forms.Field.

So, for MultiEmailField to call its parent's validate() method, it has to
use super. That's how the subclass can use the parent's code, and add some
of its own.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzwKwGWsc5%2B1BdpZK%3DJCyu88a%3DLk9gZFQg7yLR-6A6n0_k5SA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Can please someone explain this code from the docs?

2014-03-14 Thread voger
Hi, I was reading the form validation section here 
https://docs.djangoproject.com/en/dev/ref/forms/validation/ and the very 
first example is this code


from django import forms
from django.core.validators import validate_email

class MultiEmailField(forms.Field):
def to_python(self, value):
"Normalize data to a list of strings."

# Return an empty list if no input was given.
if not value:
return []
return value.split(',')

def validate(self, value):
"Check if value consists only of valid emails."

# Use the parent's handling of required fields, etc.
super(MultiEmailField, self).validate(value)  #<---What is this?

for email in value:
validate_email(email)

so the validate function calls super(MultiEmailField, 
self).validate(value) so essentially calls itself? Why? And how is this 
not ending in infinite recursion?


--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53237879.8090604%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Using Redis as a DB backend for some models (not a caching backend!)

2014-03-14 Thread Alon Nisser
Can I use redis as a django database for some of my models? I'm aware (and 
using) caching with django and redis, but I'm looking for something else 
here: Something I can use at least some of the orm features with, handle a 
django Model, etc.  I found 
django-redis-enginebut it 
doesn't look like an active project (pre alpha commits 3 years ago) 
and django-nonrel  which doesn't 
support redis and is actually a django fork and not Django proper. Any 
ideas how to proceed from here? 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/33b35731-711b-4730-bda5-0a1d9c0ffc81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Lunga Baliwe
And thank you Tom as well


On Fri, Mar 14, 2014 at 8:35 PM, Lunga Baliwe  wrote:

> Really appreciate it
>
>
> On Fri, Mar 14, 2014 at 8:34 PM, Lunga Baliwe  wrote:
>
>> I just put on the last forward slash on
>> Alias /static/ /home/project_name/website/static/
>>
>> And it worked, yho thanks Mike...
>>
>>
>> On Fri, Mar 14, 2014 at 8:29 PM, Lunga Baliwe  wrote:
>>
>>> yes I think I have on apache I got it like this.
>>>
>>> Alias /static/ /home/project_name/website/static
>>> 
>>> Order allow, deny
>>> Allow from all
>>> 
>>>
>>> I did run collecstatic aswell
>>>
>>> On Fri, Mar 14, 2014 at 8:18 PM, Tom Evans wrote:
>>>
 On Fri, Mar 14, 2014 at 6:08 PM, Lunga Baliwe 
 wrote:
 > Good day Mike,
 >
 > I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
 > website being the app name

 STATIC_ROOT has nothing to do with apps, it is where the files are
 copied to (by django) and served from (by your webserver).

 Assuming staticfiles works for you in development, there are very few
 things that you can do wrong, so (in turn):

 Have you run collectstatic to copy files from your static folders
 (application static folders and folders listed in STATICFILES_DIRS) to
 your STATIC_ROOT?

 Have you configured your webserver to serve files in the folder
 indicated by STATIC_ROOT at the URL indicated by STATIC_URL?

 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 http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFHbX1Lo%3DU9m-gMmO%2Bc-dOXNWAjj%2Bx%3DN2UkUDq9QXuNh4YV%3D9Q%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWc%2BMTesgQGxTZ47z9GRJ8Bq6buydENbdRSm_RucB6Y4%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Lunga Baliwe
Really appreciate it


On Fri, Mar 14, 2014 at 8:34 PM, Lunga Baliwe  wrote:

> I just put on the last forward slash on
> Alias /static/ /home/project_name/website/static/
>
> And it worked, yho thanks Mike...
>
>
> On Fri, Mar 14, 2014 at 8:29 PM, Lunga Baliwe  wrote:
>
>> yes I think I have on apache I got it like this.
>>
>> Alias /static/ /home/project_name/website/static
>> 
>> Order allow, deny
>> Allow from all
>> 
>>
>> I did run collecstatic aswell
>>
>> On Fri, Mar 14, 2014 at 8:18 PM, Tom Evans wrote:
>>
>>> On Fri, Mar 14, 2014 at 6:08 PM, Lunga Baliwe 
>>> wrote:
>>> > Good day Mike,
>>> >
>>> > I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
>>> > website being the app name
>>>
>>> STATIC_ROOT has nothing to do with apps, it is where the files are
>>> copied to (by django) and served from (by your webserver).
>>>
>>> Assuming staticfiles works for you in development, there are very few
>>> things that you can do wrong, so (in turn):
>>>
>>> Have you run collectstatic to copy files from your static folders
>>> (application static folders and folders listed in STATICFILES_DIRS) to
>>> your STATIC_ROOT?
>>>
>>> Have you configured your webserver to serve files in the folder
>>> indicated by STATIC_ROOT at the URL indicated by STATIC_URL?
>>>
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFHbX1Lo%3DU9m-gMmO%2Bc-dOXNWAjj%2Bx%3DN2UkUDq9QXuNh4YV%3D9Q%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWc2cm7oUr_Mmmd%3DuDvzxAqd%2B6caDjiCmzTTBPFg2Co%2Bkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Lunga Baliwe
I just put on the last forward slash on
Alias /static/ /home/project_name/website/static/

And it worked, yho thanks Mike...


On Fri, Mar 14, 2014 at 8:29 PM, Lunga Baliwe  wrote:

> yes I think I have on apache I got it like this.
>
> Alias /static/ /home/project_name/website/static
> 
> Order allow, deny
> Allow from all
> 
>
> I did run collecstatic aswell
>
> On Fri, Mar 14, 2014 at 8:18 PM, Tom Evans wrote:
>
>> On Fri, Mar 14, 2014 at 6:08 PM, Lunga Baliwe  wrote:
>> > Good day Mike,
>> >
>> > I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
>> > website being the app name
>>
>> STATIC_ROOT has nothing to do with apps, it is where the files are
>> copied to (by django) and served from (by your webserver).
>>
>> Assuming staticfiles works for you in development, there are very few
>> things that you can do wrong, so (in turn):
>>
>> Have you run collectstatic to copy files from your static folders
>> (application static folders and folders listed in STATICFILES_DIRS) to
>> your STATIC_ROOT?
>>
>> Have you configured your webserver to serve files in the folder
>> indicated by STATIC_ROOT at the URL indicated by STATIC_URL?
>>
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFHbX1Lo%3DU9m-gMmO%2Bc-dOXNWAjj%2Bx%3DN2UkUDq9QXuNh4YV%3D9Q%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWf0VxhEkO%2BBZYbc4uC6hjQC9wR895ZykXORh0rGmWhv9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Lunga Baliwe
yes I think I have on apache I got it like this.

Alias /static/ /home/project_name/website/static

Order allow, deny
Allow from all


I did run collecstatic aswell

On Fri, Mar 14, 2014 at 8:18 PM, Tom Evans  wrote:

> On Fri, Mar 14, 2014 at 6:08 PM, Lunga Baliwe  wrote:
> > Good day Mike,
> >
> > I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
> > website being the app name
>
> STATIC_ROOT has nothing to do with apps, it is where the files are
> copied to (by django) and served from (by your webserver).
>
> Assuming staticfiles works for you in development, there are very few
> things that you can do wrong, so (in turn):
>
> Have you run collectstatic to copy files from your static folders
> (application static folders and folders listed in STATICFILES_DIRS) to
> your STATIC_ROOT?
>
> Have you configured your webserver to serve files in the folder
> indicated by STATIC_ROOT at the URL indicated by STATIC_URL?
>
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFHbX1Lo%3DU9m-gMmO%2Bc-dOXNWAjj%2Bx%3DN2UkUDq9QXuNh4YV%3D9Q%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWdJKt7Pa6WB-bNGh_%2BHpnS8WSCMX0Ev7nH98v2JQ7Q17w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Tom Evans
On Fri, Mar 14, 2014 at 6:08 PM, Lunga Baliwe  wrote:
> Good day Mike,
>
> I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
> website being the app name

STATIC_ROOT has nothing to do with apps, it is where the files are
copied to (by django) and served from (by your webserver).

Assuming staticfiles works for you in development, there are very few
things that you can do wrong, so (in turn):

Have you run collectstatic to copy files from your static folders
(application static folders and folders listed in STATICFILES_DIRS) to
your STATIC_ROOT?

Have you configured your webserver to serve files in the folder
indicated by STATIC_ROOT at the URL indicated by STATIC_URL?

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Lo%3DU9m-gMmO%2Bc-dOXNWAjj%2Bx%3DN2UkUDq9QXuNh4YV%3D9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django not showing css - static files

2014-03-14 Thread Lunga Baliwe
Good day Mike,

I have STATIC_ROOT = os.path.join(BASE_DIR, 'website/static/')
website being the app name


On Fri, Mar 14, 2014 at 12:57 AM, Mike Dewhirst wrote:

> On 14/03/2014 9:05am, Luggaz wrote:
>
>> Good day,
>>
>> My static files are not showing on production, they show when I run them
>> development mode. I am running Django1.6 on apache,mod_wsgi. I get the
>> not found error on the files.
>>
>
> Have you copied all your static files into STATIC_ROOT ??
>
>
>> I have been on it for hours and have tried changing and tweaking
>> STATIC_ROOT and STATICFILES_DIR
>>
>> I have attached 3 images, the apache file, and the difference between
>> the dev and the production screenshot.
>>
>> Regards
>> Lunga
>>
>> --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/dcfa6c8e-
>> 9183-45ec-bfcf-74b5db3910c9%40googlegroups.com
>> > 9183-45ec-bfcf-74b5db3910c9%40googlegroups.com?utm_medium=
>> email_source=footer>.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/532237E0.7040001%40dewhirst.com.au.
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWegQnzOBMcM3d16PGSbDb_Z%2BvJP-ULTcSmm3wunPMxc%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem with integrating bootstrap 3.1.1 and django 1.6

2014-03-14 Thread Tom Evans
On Fri, Mar 14, 2014 at 2:33 AM, Camilo Torres  wrote:
> python manage.py startapp testapp
>
> Inside the newly created test app directory, create static/css/ and put your
> file there. Now try to reload your template to see if the template loads.
>
> This may make it work for you, but in your case, is not the final solution.
> You may need to actually put these static files that are 'site global' in a
> central location in your filesystem, let's say: /var/www/static/(css|js|etc)
>
> To do that, you need to add a setting to your settings.py:
>
> STATICFILES_DIRS = (
> '/var/www/static/',
> )
>
> That way you put all of your static site wide files inside subdirectories in
> a common path.

This advice is wrong, do not copy your static files from
/static to a folder listed in STATICFILES_DIRS.

STATICFILES_DIRS is a list of _additional_ project folders that are
searched for files _in addition_ to your application static files.

However, you do need to copy the files from your application static
directories _and_ your project static file directories to the
directory specified by STATIC_ROOT. You do not do this manually, the
management command collectstatic does this for you. You also only need
to do this in production, in development (using runserver), the static
files are served for you by runserver.

For complete info on static files, there is an excellent step-by-step doc:

https://docs.djangoproject.com/en/1.6/howto/static-files/

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2B5R7Jd-c1nduPODL66AgoXe5%3DZ8C-QXT837jBHanyTwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-nested-inlines

2014-03-14 Thread Thiago borges dos reis
the forms are not nested.



2014-03-14 10:01 GMT-03:00 Camilo Torres :

>
> On Wednesday, March 12, 2014 4:18:05 PM UTC-4:30, Thiago borges dos reis
> wrote:
>>
>> from django.contrib import admin
>> from nested_inlines.admin import NestedStackedInline,NestedModelAdmin,
>> NestedTabularInline
>> from models import Dieta, Cliente,Refeicao,Opcao
>>
>>
>> admin.site.register(Cliente)
>>
>>
>> class OpcaoInLine(NestedStackedInline):
>> model = Opcao
>> extra = 1
>>
>> class RefeicaoInLine(NestedStackedInline):
>> model = Refeicao
>> extra = 1
>> inlines = [OpcaoInLine,]
>>
>>
>> class DietaAdmin(NestedModelAdmin):
>>
>> fields= ('cliente','data_de_publicacao')
>>
>> inlines = [RefeicaoInLine,]
>>
>>
>>
>>
>> admin.site.register(Dieta,DietaAdmin)
>>
>>
>>
>> ---Didn't work
>>
> Hello,
>
> You forgot to indicate here:
> * What is your error? (backtrace)
> * Version of Django, etc.
>
> Regards,
> Camilo
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f7daa37-60ee-48e1-88d1-bf45dc289af1%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHQaGTDLNkoKV-bOWHAO7r8Z-tPPWc2QhqtuSGy1DFVkF1Wwxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


What do you think django-pony-forms

2014-03-14 Thread Fabio Caritas Barrionuevo da Luz
Hello everyone, 
I found django-pony-forms[1] recently. 
I found it very interesting proposal by adding the possibility of better 
defining how a form is rendered without having to use a templatetag or 
something, and also because it can make an individual customization of the 
form a little more "simple".

I have two questions: 

1) If I use django-pony-forms lose much performance, compared with the 
standard form. 

2) Is there another possible problem in addressing django-pony-forms used?



[1] https://github.com/mbraak/django_pony_forms
[2] http://django-pony-forms.readthedocs.org/en/latest/

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e5f8526-85ee-491a-b46f-de624dab157a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I start with this project with django

2014-03-14 Thread Camilo Torres
On Friday, March 14, 2014 1:52:44 AM UTC-4:30, Rob L wrote:
>
> The feature list of the project I am wishing to do is:
>
>- Let users upload some images(a folder contains image files)
>- Backend generates static htmls to present those images, basically as 
>a gallery, via an generated url
>- User can select from default themes(templates)
>   - The template I am talking about here is not django template, they 
>   are a bunch of xhtml, css and js files can be choose from default or 
>   uploaded by user. 
>- User can upload and use their customized templates
>   - I made a local Python program that can work for the purpose here: 
>   https://github.com/viewplatgh/pgal, maybe can help you understand 
>   the feature I am trying to implement on the django project
>- The workflow is quite similar to http://codepen.io, but what user 
>inputs are images, optionally templates, css and js files, rather than 
> html 
>file itself. The htmls are generated by django app, and create a short url 
>for people who uploaded/built their resources to view the gallery.
>
> I know this app don't have to be implemented by using django. I 
> choose django because Python is the language I'm familiar with and it's the 
> framework I have a little experience with, but to implement such a site I 
> have so many questions and don't know where to start. I don't expect an 
> exact answer to this post, but just hope to collect more helpful 
> information, resources and ideas from experienced programmers to help me 
> kick my project off...
>
> Here is some questions in my mind currently:
>
>- Would django allow me to write a bunch of files at backend? 
>- Unlike php, django's urls don't map to server's folders. But I need 
>that feature to let user view the generated statics. How do I work through 
>this. Should I generate django templates?
>- How to prevent user from uploading malicious stuff to backend...
>
> Hello,

* Would django allow me to write a bunch of files at backend?

Yes, as any python program does. You only need to manage how to upload 
files to your application and the you can put these files wherever you need 
in your server file system.

*Unlike php, django's urls don't map to server's folders. But I need that 
feature to let user view the generated statics. How do I work through this. 
Should I generate django templates?

That is right. You should generate your static content in a static 
directory outside of Django, and that static directory will be served by a 
web server, not Django directly. See:
https://docs.djangoproject.com/en/1.6/howto/static-files/

* How to prevent user from uploading malicious stuff to backend...

By filtering the content in some way. There is no way that Django knows 
what is malicious by itself. You should write code (or user existing tools) 
to inspect the content uploaded by users and filter what you consider 
malicious.

Regards,
Camilo

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4edef3c2-e6ff-423e-84ce-cd1d63f73063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I start with this project with django

2014-03-14 Thread Rob L
Hi, 

I hope this is a right place to ask, not very sure where to post on 
internet.
It's about planning a django project, maybe a similar django package has 
been already there, if it's true, I hope someone can tell me which it is.

The feature list of the project I am wishing to do is:

   - Let users upload some images(a folder contains image files)
   - Backend generates static htmls to present those images, basically as 
   a gallery, via an generated url
   - User can select from default themes(templates)
  - The template I am talking about here is not django template, they 
  are a bunch of xhtml, css and js files can be choose from default or 
  uploaded by user. 
   - User can upload and use their customized templates
  - I made a local Python program that can work for the purpose 
  here: https://github.com/viewplatgh/pgal, maybe can help you understand 
the 
  feature I am trying to implement on the django project
   - The workflow is quite similar to http://codepen.io, but what user 
   inputs are images, optionally templates, css and js files, rather than html 
   file itself. The htmls are generated by django app, and create a short url 
   for people who uploaded/built their resources to view the gallery.

I know this app don't have to be implemented by using django. I 
choose django because Python is the language I'm familiar with and it's the 
framework I have a little experience with, but to implement such a site I 
have so many questions and don't know where to start. I don't expect an 
exact answer to this post, but just hope to collect more helpful 
information, resources and ideas from experienced programmers to help me 
kick my project off...

Here is some questions in my mind currently:

   - Would django allow me to write a bunch of files at backend? 
   - Unlike php, django's urls don't map to server's folders. But I need 
   that feature to let user view the generated statics. How do I work through 
   this. Should I generate django templates?
   - How to prevent user from uploading malicious stuff to backend...

Any suggestions, ideas would be appreciated. Thanks! 

Thanks
Rob L

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10a15408-3025-4e97-8276-f2ca8a17fbb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-nested-inlines

2014-03-14 Thread Camilo Torres

On Wednesday, March 12, 2014 4:18:05 PM UTC-4:30, Thiago borges dos reis 
wrote:
>
> from django.contrib import admin
> from nested_inlines.admin import 
> NestedStackedInline,NestedModelAdmin,NestedTabularInline
> from models import Dieta, Cliente,Refeicao,Opcao
>
>
> admin.site.register(Cliente)
>
>
> class OpcaoInLine(NestedStackedInline):
> model = Opcao
> extra = 1
>
> class RefeicaoInLine(NestedStackedInline):
> model = Refeicao
> extra = 1
> inlines = [OpcaoInLine,]
>
>
> class DietaAdmin(NestedModelAdmin):
>
> fields= ('cliente','data_de_publicacao')
>
> inlines = [RefeicaoInLine,]
>
>
>
>
> admin.site.register(Dieta,DietaAdmin)
>
>
>
> ---Didn't work
>
Hello,

You forgot to indicate here:
* What is your error? (backtrace)
* Version of Django, etc.

Regards,
Camilo

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f7daa37-60ee-48e1-88d1-bf45dc289af1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-quiz modification

2014-03-14 Thread Camilo Torres
On Wednesday, March 12, 2014 9:39:16 AM UTC-4:30, orchid barua wrote:
>
> The view portion has this:
> def question_check_anon(request, quiz):
> """
> check if a question is correct, adds to score if needed and return the 
> previous questions details
> """
> quiz_id = str(quiz.id)
> guess = request.GET['guess']
> answer = Answer.objects.get(id=guess)
> question = answer.question  #  the id of the question
> 
> if answer.correct == True:
> outcome = "correct"
> score = quiz_id + "_score"
> current = request.session[score]
> current = int(current) + 1
> request.session[score] = current  #  add 1 to the score
> anon_session_score(request, 1, 1)
> else:
> outcome = "incorrect"
> anon_session_score(request, 0, 1)
> 
> if quiz.answers_at_end != True:  #  display answer after each question
> return {'previous_answer': answer, 'previous_outcome': outcome, 
> 'previous_question': question, }
> else:  #  display all answers at end
> return {}
> Related template :
> 
>
> 
> 
> 
>
>
> {% for answer in answers %}
> 
> 
> 
>  class="form-radio">
> {{ answer.content }}
> 
> 
> 
> {% endfor %}
> 
> 
> 
> 
>
> I guess I will change the template to
>
> 
>class="form-radio"> True  False ||
> 
>{{ answer.content }}
>  
>
> and view to:
> if answer.correct == True:
> outcome = "correct"
> score = quiz_id + "_score"
> current = request.session[score]
> current = int(current) + 1
> request.session[score] = current  #  add 1 to the score
> anon_session_score(request, 1, 1)
> elif answer.incorrect == True:
> outcome = "correct"
> score = quiz_id + "_score"
> current = request.session[score]
> current = int(current) + 1
> request.session[score] = current
> anon_session_score(request, 1, 1)
> else:
> outcome = "incorrect"
> anon_session_score(request, 0, 1)
>
>
> but the result is not what I expected.
>
>
>
> On Monday, March 10, 2014 12:04:35 PM UTC+6, orchid barua wrote:
>>
>> I want to modify the django-quiz application.
>> https://github.com/tomwalker/django_quiz
>>
>> The quesiton will be a multiple true false type. Each question will have 
>> 5 stem, each will be tested for true/false. Each will carry partial marks 
>> eg. 1 will be awarded for a correct ans. And there will be a system for 
>> penalty eg. deduct 0.5 marks for a wrong answer of a stem. 
>>
> Hello

For what I understand you only like to apply a penalty of 0.5 to incorrect 
answers, so, does calling anon_session_score(request, -0.5, 1) works for 
this?

Yours,
Camilo 

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eab0ea31-4e94-470a-9800-1ce782d819df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Timeseries Data Collection as a Reusable App

2014-03-14 Thread RLange
Thank you all for the great input.

Russell, your design I think will make the best framework - after all, 
defining and registering a model is hardly more difficult than defining 
each model in the settings. Plus, I'm realizing now that each *type* of 
data may come with its own particular functions, so it makes sense to group 
related models together into an app. It is indeed looking more and more 
like a clone of the admin app in terms of how it pulls together and 
abstracts data from other apps.

Jonathan, I'm certainly going to take inspiration from your time-series 
app, but I don't think I can use it for this particular application - my 
data points are much simpler (each of my data points is marked with only a 
single datetime, and that suffices). I'll look into postgresql as well, 
although again my models are fairly simple and not relying too heavily on 
relational fields.

Regards,
RL

On Wednesday, March 12, 2014 9:44:48 AM UTC-4, Jonathan Morgan wrote:
>
> On the model side, to facilitate a generic visualization layer, you could 
> also consider an abstract parent class where you standardize time series 
> information that isn't the data.
>
> For my time series data, I have this:
>
> https://github.com/jonathanmorgan/django_time_series
>
> I built a few django time-series models, then started to abstract out the 
> parts that were the same across the models.  This includes:
>
> - a Time_Period model to hold a set of defined time periods, if your time 
> periods are more complex than simply time increments (for example, I did 
> time-series of reddit activity within subreddits, broken out by hour, and 
> also categorized into being within 14 days before and after a certain date 
> - so before-1, before-2, before-3, ..., after-1, after-2, after-3, ...).
>
> - an AbstractTimeSeriesDataModel that includes basic information on a time 
> period (start and end datetime, time period index, a separate aggregate 
> index in case you have something like my before and after, and so have 
> after-1, which is actually number 327 overall, etc.), plus the ability to 
> set and hold ten different generic filters (so you can mark a given time 
> period as having contained links to news, for example, using filter_1, and 
> store a count of matches within the period in match_count_1, or use 
> filter_2 and match_count_2 to note a particular time-series period had X 
> posts related to a particular topic), and base methods for doing a lookup 
> and retrieving an instance.
>
>
> Then, for a particular data set, you extend this abstract class and add in 
> columns you want to track within a given time period (see 
> https://github.com/jonathanmorgan/reddit_data for an example - the model 
> Subreddit_Time_Series_Data is a much more complete example than 
> Domain_Time_Series_Data).
>
> An abstract base class like this would give you the common elements of 
> time-series data on which you could start to build a generic visualizer, 
> and also then give you the flexibility to add data as needed.  You could 
> probably just use a simple naming convention to reveal added columns as 
> data ("tsdata_").
>
> You could also probably add generic data fields to this abstract model, 
> but it didn't seem to be useful for me when I built this, since I was 
> capturing many fields per time series, and I kept having to add fields as 
> our research led to more questions.
>
>
> Also worth noting, if you go with a relational database (I personally like 
> relational databases for complex, relational data) and might have millions 
> of rows, postgresql is much easier to get reasonable performance out of 
> than mysql.
>
> On Tuesday, March 11, 2014 10:42:24 AM UTC-5, RLange wrote:
>>
>> I'm currently working on an app for browsing and visualizing time-series 
>> data. Each point of time-series data may be a mix of Strings, Floats, and 
>> Ints. In my current design, I have a separate model for each of my data 
>> types, and I have been writing a new view for each one. In other words, my 
>> app is strongly coupled to the structure of the models. *Ideally*, my 
>> app would use some sort of generic abstraction of a time-series model such 
>> that adding new types of data is a simple settings.py configuration, and 
>> the views for browse/visualize would be free. 
>>
>> I see a few possible avenues to accomplish this. None seems clearly 
>> better than any other. My database is MySQL. Any feedback is helpful!
>>
>>1. Use django-mutant (or equivalent) to make new models on the fly. 
>>However I would really only need to make models at initialization time, 
>> not 
>>at runtime.
>>2. Instead of a column for each dimension of the data, use a Blob or 
>>Text type for headers and one for data (a hack for variable-length data. 
>>makes intelligent queries nearly impossible)
>>3. Forget about pluggability and continue developing under the 
>>assumption that this app will never leave "in-house"
>>
>>
>> This 

Admin TabularInline show_url doesn't works.

2014-03-14 Thread Fabrizio Alongi
Hi, I've my Django Product and Lists Product with m2m relation with an 
intermediate model.
My problem is that in admin, when I show one List with related products 
(with TabularInline), in the product row I have a ForeignKey field 
(rendered with drop down widget) and up to it a string with current item 
name.

I've noticed that this is part of tabular.html admin template... and in it, 
I've noticed that there is a show_url property
What I want is to show the link that point to the product change page in 
place of current product name string


Is it possible without edit the tabular.html template?

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/583ee169-ce45-409b-866e-c6ea8cab0660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Documentation of modules

2014-03-14 Thread Christian Waterkeyn

Thanks Camillo!

This is rather complete code, but as it is extensively documented, it 
satisfies my request!

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e773e96-2040-4083-97b1-e1452c244029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.