Re: How to monitor content updates or deletion in Django web applications

2023-10-04 Thread Timothy Myers
I am also not sure of the scope of your question.  If you're asking about a
file deleted from the system by a method other than Django.  I use a 
trusted database
of files required with a hash and have a process (Django script) that runs 
and checks
both the presence of a file and its hash code.   
This notifies me of not only deletions but also changes to core items that 
I want to monitor by any 
method outside my control updates that maintain the trusted database and 
log dates who made the change.   
This also helped me monitor for duplicate pictures and files so that if 
someone loads a second copy of the 
same picture for a different page even with a different name it is noted by 
the hashcode.  So if one image is being
updated other pages can be reviewed as well to see if they should be 
updated at the same time.  Do we need both 
or should we change both images and update both pages? 
There is also a file with pages and keys to external use static items on a 
page.  Many are done systematically with
code and databases this picture, this text, and this format so the 
programmed changes also maintain much of the database 
updates.  The more pages added the more complex the maintenance without the 
help from the system as pages are 
added and deleted or updated.
This ensures that an image is not removed if removing a page and it is not 
the only user of the image.  This
helps prevent broken links or you can scan logs for 404 but then a user 
gets the message instead of prevention.


The signals are great for triggering events done through Django code and 
database actions.  But I don't think
it can detect that an image was substituted or deleted outside of its code 
base but OS commands or rouge programs.
It would be much harder to both change the file and update the hashcode.  
Using signals and a trusted db might 
give you the best of both worlds
On Tuesday, October 3, 2023 at 9:59:00 PM UTC-6 David Nugent wrote:

> The may not be enough context in your question but I imagine that the 
> following link may take you to something that may work for you.
>
> https://docs.djangoproject.com/en/4.2/topics/signals/
>
>
> On 4 October 2023 at 14:42:45, Ram (ram.mu...@gmail.com) wrote:
>
>> Hi,
>>
>> We would like to add this feature in our Web application and capture the 
>> following events in log files:
>>
>> 1. If any image is deleted by any reason
>> 2. Any content is deleted by any reason
>>
>> Does Django have any libraries or functions to achieve this?
>>
>> Best regards,
>> ~Ram
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F3GDxbL_3C20ygwE9yumUdLxDgZJRdLEuM9Wdm%2BeTyfEA%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3cf742a1-9ca8-4209-9c7a-b925ad368244n%40googlegroups.com.


KeyError for CSRF middleware during processing an exception response

2019-09-11 Thread Timothy Gates
If an exception response occurs during the middleware processing it looks 
like the CSRF middleware layer can obscure the issue by getting a KeyError 
exception of its own. The request.META does not contain the CSRF_COOKIE but 
the response handling seems to assume it has already been set. I get the 
error...

File 
"/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py", 
line 34, in inner
 response = get_response(request)
   File 
"/usr/local/lib/python3.6/dist-packages/django/utils/deprecation.py", line 
96, in __call__
 response = self.process_response(request, response)
   File "/usr/local/lib/python3.6/dist-packages/django/middleware/csrf.py", 
line 325, in process_response
 self._set_token(request, response)
   File "/usr/local/lib/python3.6/dist-packages/django/middleware/csrf.py", 
line 189, in _set_token
 request.META['CSRF_COOKIE'],
 KeyError: 'CSRF_COOKIE'


I'd be interested in raising a ticket for this and putting in some code to 
either generate the CSRF Cookie or gracefully ignoring the situation of a 
missing CSRF Cookie. I had a look through the mail archives but couldn't 
find a similar experience which surprised me but I guess the normal 
response is to fix the underlying issue and not worry about the KeyError 
from the CSRF Cookie but I think it would be worth removing the 
red-herring. I also could be way off track so please let me know if this is 
the case.

Thanks,
Tim

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/246c2e11-643a-4425-9742-e4cbf2a5c575%40googlegroups.com.


Re: How to create a a drop-down menu from the logged in username

2019-09-09 Thread Mugabi Timothy
you can use the above list dropdown but use the templating engine in django

On Mon, Sep 9, 2019 at 12:00 PM Mugabi Timothy  wrote:

>  
>> https://example.com"; id="dropdown01" data-toggle="dropdown"
>> aria-haspopup="true" aria-expanded="false">welcome
>> {{request.user.username}}
>> > aria-labelledby="dropdown01">
>> Profile
>> 
>> Change Password
>> 
>> Logout
>> 
>>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADjO_C4wCAwoSsF59DDRkmm5S1qSpOANJDYzqYovS-Y_4D4q3w%40mail.gmail.com.


Re: Generate CUID Client Side

2019-05-17 Thread Timothy Cook
On Fri, May 17, 2019 at 10:23 AM Mario R. Osorio 
wrote:

> This question is OT however; *cuid *being a js library, what you have to
> do is have your templates include the necessary libraries and make use of
> them.
>
>
>
Well, it's not exactly off topic. I am specifically asking about
integration with Django templates so that I can generate CUIDs in the
client browser.
Currently, I do it in the view via the Python library
<https://github.com/necaris/cuid.py>. But that always uses the information
from the server.
But thanks anyway.



>
>
>
> On Thursday, May 16, 2019 at 9:09:13 AM UTC-4, Timothy Cook wrote:
>>
>> I have a project where I want to generate a CUID client side to send to a
>> REST API service as the document name.
>>
>> My question is how to best include the cuid library
>> <https://github.com/ericelliott/cuid> so that the client browser is
>> generating the CUID and how to implement this in the template so I can post
>> this cuid back to the view.
>>
>> Thanks,
>> Tim
>>
>> --
>> Timothy W. Cook, CEO
>> Data Insights, Inc.
>>
> --
> 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/9a4e9bd3-398c-4796-bc39-f895973b0feb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9a4e9bd3-398c-4796-bc39-f895973b0feb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Timothy W. Cook, CEO
Data Insights, Inc.

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


Generate CUID Client Side

2019-05-16 Thread Timothy Cook
I have a project where I want to generate a CUID client side to send to a
REST API service as the document name.

My question is how to best include the cuid library
<https://github.com/ericelliott/cuid> so that the client browser is
generating the CUID and how to implement this in the template so I can post
this cuid back to the view.

Thanks,
Tim

-- 
Timothy W. Cook, CEO
Data Insights, Inc.

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


Re: Use Email to Login With Django Auth

2018-11-01 Thread Timothy Cook
I use this and it works great.
https://django-allauth.readthedocs.io/en/latest/installation.html



On Thu, Nov 1, 2018 at 9:08 AM Ryan Shepard  wrote:

> How could i go about allowing people to also use their email to sign into
> Django instead of a username? I have done research my self and tried
> creating my own backend for it. But it doesn't 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/d6046362-5149-4edf-adc8-273547213748%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d6046362-5149-4edf-adc8-273547213748%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Timothy W. Cook, CEO
Data Insights, Inc.

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


Re: Registration form submission problem

2016-09-17 Thread Timothy Steele
below is also the views.py file for the registration form

def register_page(request):
if request.method=="POST":
form=RegistrationForm(request.POST)
if form.is_valid():
user=User.objects.create_user(
username=form.clean_data['username'],
password=form.clean_data['password1'],
email=form.clean_data['email']
)
return HttpResponseRedirect('/')
else:
form=RegistrationForm()
variables=RequestContext(request,{'form':form })
return render_to_response(
'registration/register.html', variables
)


On Saturday, September 17, 2016 at 9:02:52 AM UTC+1, Timothy Steele wrote:
>
> first i created a Login form and an error message show as  *CSRF token 
> missing or incorrect.*
> I was able to work it out by adding* {% csrf_token %}* int the login form 
> and adding the import file in the views as from *django.template import 
> Context,RequestContext.*
>
> But when i created a registration form the same problem came and i  submit 
> the form, i added the {% csrf_token %} file in the registration form but 
> it did not work. 
> the code are shown below
>
> {% extends "base.html" %}
> {% block title %}User Registration{% endblock %}
> {% block head %}User Registration{% endblock %}
> {% block content %}
>
> 
> {% csrf_token %}{{ form.as_p }}
> 
> 
> {% endblock %}
>
>

-- 
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/5e200b47-6e50-4af2-9922-f77e79d46a74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Registration form submission problem

2016-09-17 Thread Timothy Steele
first i created a Login form and an error message show as  *CSRF token 
missing or incorrect.*
I was able to work it out by adding* {% csrf_token %}* int the login form 
and adding the import file in the views as from *django.template import 
Context,RequestContext.*

But when i created a registration form the same problem came and i  submit 
the form, i added the {% csrf_token %} file in the registration form but it 
did not work. 
the code are shown below

{% extends "base.html" %}
{% block title %}User Registration{% endblock %}
{% block head %}User Registration{% endblock %}
{% block content %}


{% csrf_token %}{{ form.as_p }}


{% endblock %}

-- 
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/7a4c5b24-de8e-4815-96e5-6452f6a996b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: creating a loginpage

2016-09-14 Thread Timothy Steele
Thanks Tim it has work this time but can any one help me with a beginner 
book to learn Django please



On Wednesday, September 14, 2016 at 4:44:14 PM UTC+1, Timothy Steele wrote:
>
> Instead of providing the view itself, i want to  pass its module path as a 
> string in the urls.py file  as the code below
>
>
> urlpatterns = ['',
>  url(r'^$', main_page),
>  url(r'^user/(\w+)/$', user_page),
>  url(r'^login/$', 'django.contrib.auth.views.login'),
> ]
>
> but it return this information
> TypeError: view must be a callable or a list/tuple in the case of include()
>
>
> please any help
>
> below is also the HTML form .
>
> 
> 
> 
> 
> Django Bookmark - User Login
> 
> 
> User Login
> {% if form.has_errors %}
> Your username and password didn't match.
>
> {% endif %}
> 
> Username:{{ form.username }}
> Password:{{ form.password }}
> 
> 
> 
> 
> 
>
>

-- 
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/056f8dd1-258e-49de-b6af-63c7ab5807ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: creating a loginpage

2016-09-14 Thread Timothy Steele
Tim Graham, I did it but i get back this error *login() missing 1 required 
positional argument: 'user' *

On Wednesday, September 14, 2016 at 4:44:14 PM UTC+1, Timothy Steele wrote:
>
> Instead of providing the view itself, i want to  pass its module path as a 
> string in the urls.py file  as the code below
>
>
> urlpatterns = ['',
>  url(r'^$', main_page),
>  url(r'^user/(\w+)/$', user_page),
>  url(r'^login/$', 'django.contrib.auth.views.login'),
> ]
>
> but it return this information
> TypeError: view must be a callable or a list/tuple in the case of include()
>
>
> please any help
>
> below is also the HTML form .
>
> 
> 
> 
> 
> Django Bookmark - User Login
> 
> 
> User Login
> {% if form.has_errors %}
> Your username and password didn't match.
>
> {% endif %}
> 
> Username:{{ form.username }}
> Password:{{ form.password }}
> 
> 
> 
> 
> 
>
>

-- 
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/5e825c03-2a27-407b-aae9-3d389fbbf3ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


creating a loginpage

2016-09-14 Thread Timothy Steele
Instead of providing the view itself, i want to  pass its module path as a 
string in the urls.py file  as the code below


urlpatterns = ['',
 url(r'^$', main_page),
 url(r'^user/(\w+)/$', user_page),
 url(r'^login/$', 'django.contrib.auth.views.login'),
]

but it return this information
TypeError: view must be a callable or a list/tuple in the case of include()


please any help

below is also the HTML form .





Django Bookmark - User Login


User Login
{% if form.has_errors %}
Your username and password didn't match.

{% endif %}

Username:{{ form.username }}
Password:{{ form.password }}






-- 
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/bc8c139d-7997-44d5-a1a2-183d56eb1a59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to display models in templates

2016-09-13 Thread Timothy Steele
thank you very mach it has work. i am most grateful, any way this did not 
let me sleep the hole night 

On Tuesday, September 13, 2016 at 8:33:53 AM UTC+1, Timothy Steele wrote:
>
> please i try my best but i can display my models in a templates i have 
> just created.
>
> *Please have a look at the codes in the models.py file*
>
> from django.db import models
> from django.contrib.auth.models import User
> # Create your models here.
>
> class Link(models.Model):
> url=models.URLField(unique=True)
>
> def __str__(self):
> return self.url
>
>
>
> class Bookmark(models.Model):
> title=models.CharField(max_length=200)
> user=models.ForeignKey(User)
> link=models.ForeignKey(Link)
> def __str__(self):
> return self.title
>
> *Please have a look at the codes in the  templates file call 
> user_page.html*
>
> head>
> 
> Django Bookmarks - User:{{ username }}
> 
> 
> Bookmarks for {{ username }}
> {% if bookmarks %}
>
>   {% for bookmark in bookmaks %}
>{{ bookmarks.title}}
>   {% endfor %}
>
> {% else %}
> No bookmark found.
> {% endif %}
>
>
> 
>
> This the codes from the views.py file (the object of the user_page)
>
>
> from django.shortcuts import render
> from django.http import HttpResponse,Http404
> from django.template import Context
> from django.template.loader import get_template
> from django.contrib.auth.models import User
> from . models import Bookmark,Link
>
>
> def user_page(request, username):
>
>try:
> user=User.objects.get(username=username)
>
> except:
> raise Http404('Requested user not found.')
> bookmarks=user.bookmark_set.all()
> template=get_template('user_page.html')
> variables=Context({
> 'username':username,
> 'bookmarks': bookmarks
> })
> output=template.render(variables)
> return HttpResponse(output)
>
> *i try it out but it only give me this*
>
>
> <https://lh3.googleusercontent.com/-OB60iPiyBoU/V9ertDA2BgI/AEo/Sr5kuhswLbcXgfHoWWz6GHyAivtbVZO6ACLcB/s1600/gg.png>
>
>

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


Re: how to display models in templates

2016-09-13 Thread Timothy Steele
thanks i have seen it, but i need to only display  *Packt Publishing* but 
it give this ** in addition 

On Tuesday, September 13, 2016 at 8:33:53 AM UTC+1, Timothy Steele wrote:
>
> please i try my best but i can display my models in a templates i have 
> just created.
>
> *Please have a look at the codes in the models.py file*
>
> from django.db import models
> from django.contrib.auth.models import User
> # Create your models here.
>
> class Link(models.Model):
> url=models.URLField(unique=True)
>
> def __str__(self):
> return self.url
>
>
>
> class Bookmark(models.Model):
> title=models.CharField(max_length=200)
> user=models.ForeignKey(User)
> link=models.ForeignKey(Link)
> def __str__(self):
> return self.title
>
> *Please have a look at the codes in the  templates file call 
> user_page.html*
>
> head>
> 
> Django Bookmarks - User:{{ username }}
> 
> 
> Bookmarks for {{ username }}
> {% if bookmarks %}
>
>   {% for bookmark in bookmaks %}
>{{ bookmarks.title}}
>   {% endfor %}
>
> {% else %}
> No bookmark found.
> {% endif %}
>
>
> 
>
> This the codes from the views.py file (the object of the user_page)
>
>
> from django.shortcuts import render
> from django.http import HttpResponse,Http404
> from django.template import Context
> from django.template.loader import get_template
> from django.contrib.auth.models import User
> from . models import Bookmark,Link
>
>
> def user_page(request, username):
>
>try:
> user=User.objects.get(username=username)
>
> except:
> raise Http404('Requested user not found.')
> bookmarks=user.bookmark_set.all()
> template=get_template('user_page.html')
> variables=Context({
> 'username':username,
> 'bookmarks': bookmarks
> })
> output=template.render(variables)
> return HttpResponse(output)
>
> *i try it out but it only give me this*
>
>
> <https://lh3.googleusercontent.com/-OB60iPiyBoU/V9ertDA2BgI/AEo/Sr5kuhswLbcXgfHoWWz6GHyAivtbVZO6ACLcB/s1600/gg.png>
>
>

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


Re: how to display models in templates

2016-09-13 Thread Timothy Steele


<https://lh3.googleusercontent.com/-AiF038nKeBk/V9exW5xi3gI/AE8/QHZ6B-WTzWspm9f0iFdOMaxGROHR33XDwCLcB/s1600/hap.png>
please i like your help but it now return in the database, but in can see 
the name of the bookmark but how can i do away with the QuerySet please

On Tuesday, September 13, 2016 at 8:45:33 AM UTC+1, ludovic coues wrote:
>
> Can you try this in your template ?
>
> {{ bookmarks|pprint }}
> {% for bookmark in bookmaks %}
>{{ bookmark|pprint }}
> {% endfor %}
>
> Also, in your for loop, you use bookmarks.title, notice the s.
>
> 2016-09-13 9:33 GMT+02:00 Timothy Steele  >:
>
>> please i try my best but i can display my models in a templates i have 
>> just created.
>>
>> *Please have a look at the codes in the models.py file*
>>
>> from django.db import models
>> from django.contrib.auth.models import User
>> # Create your models here.
>>
>> class Link(models.Model):
>> url=models.URLField(unique=True)
>>
>> def __str__(self):
>> return self.url
>>
>>
>>
>> class Bookmark(models.Model):
>> title=models.CharField(max_length=200)
>> user=models.ForeignKey(User)
>> link=models.ForeignKey(Link)
>> def __str__(self):
>> return self.title
>>
>> *Please have a look at the codes in the  templates file call 
>> user_page.html*
>>
>> head>
>> 
>> Django Bookmarks - User:{{ username }}
>> 
>> 
>> Bookmarks for {{ username }}
>> {% if bookmarks %}
>>
>>   {% for bookmark in bookmaks %}
>>{{ bookmarks.title}}
>>   {% endfor %}
>>
>> {% else %}
>> No bookmark found.
>> {% endif %}
>>
>>
>> 
>>
>> This the codes from the views.py file (the object of the user_page)
>>
>>
>> from django.shortcuts import render
>> from django.http import HttpResponse,Http404
>> from django.template import Context
>> from django.template.loader import get_template
>> from django.contrib.auth.models import User
>> from . models import Bookmark,Link
>>
>>
>> def user_page(request, username):
>>
>>try:
>> user=User.objects.get(username=username)
>>
>> except:
>> raise Http404('Requested user not found.')
>> bookmarks=user.bookmark_set.all()
>> template=get_template('user_page.html')
>> variables=Context({
>> 'username':username,
>> 'bookmarks': bookmarks
>> })
>> output=template.render(variables)
>> return HttpResponse(output)
>>
>> *i try it out but it only give me this*
>>
>>
>> <https://lh3.googleusercontent.com/-OB60iPiyBoU/V9ertDA2BgI/AEo/Sr5kuhswLbcXgfHoWWz6GHyAivtbVZO6ACLcB/s1600/gg.png>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/13bc97fb-359d-4be7-b1b9-9cdb84a4a3a9%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/13bc97fb-359d-4be7-b1b9-9cdb84a4a3a9%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Cordialement, Coues Ludovic
> +336 148 743 42
>

-- 
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/68cedb00-b2bc-48a0-b3c2-b497ef141940%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how to display models in templates

2016-09-13 Thread Timothy Steele
please i try my best but i can display my models in a templates i have just 
created.

*Please have a look at the codes in the models.py file*

from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Link(models.Model):
url=models.URLField(unique=True)

def __str__(self):
return self.url



class Bookmark(models.Model):
title=models.CharField(max_length=200)
user=models.ForeignKey(User)
link=models.ForeignKey(Link)
def __str__(self):
return self.title

*Please have a look at the codes in the  templates file call user_page.html*

head>

Django Bookmarks - User:{{ username }}


Bookmarks for {{ username }}
{% if bookmarks %}
   
  {% for bookmark in bookmaks %}
   {{ bookmarks.title}}
  {% endfor %}
   
{% else %}
No bookmark found.
{% endif %}




This the codes from the views.py file (the object of the user_page)


from django.shortcuts import render
from django.http import HttpResponse,Http404
from django.template import Context
from django.template.loader import get_template
from django.contrib.auth.models import User
from . models import Bookmark,Link


def user_page(request, username):

   try:
user=User.objects.get(username=username)

except:
raise Http404('Requested user not found.')
bookmarks=user.bookmark_set.all()
template=get_template('user_page.html')
variables=Context({
'username':username,
'bookmarks': bookmarks
})
output=template.render(variables)
return HttpResponse(output)

*i try it out but it only give me 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/13bc97fb-359d-4be7-b1b9-9cdb84a4a3a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How t o create more than one application

2016-08-14 Thread Timothy Steele
Thanks

On Sat, Aug 13, 2016 at 7:34 PM, Andrew Emory  wrote:

> Just enter the command: python manage.py startapp app_name from your
> terminal window in the projects source directory.
>
> On Friday, August 12, 2016 at 7:37:10 PM UTC-5, Timothy Steele wrote:
>>
>>
>>
>> down votefavori
>> <http://stackoverflow.com/questions/11488838/multiple-applications-with-django#>
>>
>> I am studying the Django framework, reading the documentation, but have
>> not found references on how to create more than one application on the same
>> project, where each application has multiple apps.
>>
>> can some one help plz
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/-LYD8pcmA9o/unsubscribe.
> To unsubscribe from this group and all its topics, 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/c9a95a9b-7be6-403e-b92f-5e56858cf144%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c9a95a9b-7be6-403e-b92f-5e56858cf144%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: How t o create more than one application

2016-08-12 Thread Timothy Steele


On Saturday, August 13, 2016 at 1:37:10 AM UTC+1, Timothy Steele wrote:
>
>
>
> down votefavori 
> <http://stackoverflow.com/questions/11488838/multiple-applications-with-django#>
>
> I am studying the Django framework, reading the documentation, but have 
> not found references on how to create more than one application on the same 
> project, where each application has multiple apps.
>
> can some one help plz
>
Please i have being able to solve it,  thanks to all  

-- 
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/db4493cb-e695-4ca1-8d92-f6ac287a4736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How t o create more than one application

2016-08-12 Thread Timothy Steele


down votefavori 


I am studying the Django framework, reading the documentation, but have not 
found references on how to create more than one application on the same 
project, where each application has multiple apps.

can some one help plz

-- 
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/90b6d09b-02f3-44f5-a271-cd0765bd1998%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding custom Template downloaded

2016-08-08 Thread Timothy Steele
THANK YOU

On Monday, August 8, 2016 at 2:55:23 PM UTC+1, Timothy Steele wrote:
>
> I want to get  a step by step process on how to add a django template 
> downloaded 
> so that i can over ride the default template that django give to me by 
> default
> Please any help
>
> Thanks
>
>

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


Re: Adding custom Template downloaded

2016-08-08 Thread Timothy Steele

Please What I am Talking about is this 
i have download  a template from www.github.com, but i can not configure it 
and i need a help please 

On Monday, August 8, 2016 at 2:55:23 PM UTC+1, Timothy Steele wrote:
>
> I want to get  a step by step process on how to add a django template 
> downloaded 
> so that i can over ride the default template that django give to me by 
> default
> Please any help
>
> Thanks
>
>

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


Adding custom Template downloaded

2016-08-08 Thread Timothy Steele
I want to get  a step by step process on how to add a django template
downloaded
so that i can over ride the default template that django give to me by
default
Please any help

Thanks

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


Re: Please Can Some one Help me To get my static files load my default CSS files

2016-08-08 Thread Timothy Steele
M Hashmi
Thanks
For the response it work for me.
I will like you to also give me a step by step process on how to add a
template downloaded
so that i can change the default template

On Mon, Aug 8, 2016 at 11:49 AM, M Hashmi  wrote:

> You need to set your static in settings.py and I am giving you simplest
> idea you can implement with no issues.
>
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static-only')
> MEDIA_URL = '/media/'
> MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')
> STATICFILES_DIRS = [
>os.path.join(BASE_DIR, 'static', 'static'),
> ]
>
> Now in your project source folder create a new folder named 'static' which
> will refer to values in blue.
> In your 'static' in blue folder create subfolders with names 'media',
> static-only', 'templates' and 'static' again. So hierarchy should look like
> this:
>
> static
> static
> media
> static-only
> templates
>
> In your settings.py in "TEMPLATE" section find simalr line like below and
> change it as I did.
>
> 'DIRS': [os.path.join(BASE_DIR, 'static', 'templates')],
>
> Now go to your terminal (command shell) and run following command.
> ./manage.py collectstatic
>
> It will ask you are you sure you want to do this. Type "yes" and press
> enter.
>
> .manage.py runserver and refresh your page.
>
> You will get all the css loaded.
>
> Furthermore you can create three new folders in your /static/static/.
>
> static
> static
>  |
>  ---css
>  |
>  ---js
>  |
>  ---images
> media
> static-only
> templates
>
> In your static/static folder you can keep the project template related
> css/js/images. All your html based code will go to /static/templates
> folder. Read the link below thorough and in case of issues you can post
> another question or to same thread.
>
> https://docs.djangoproject.com/en/1.10/howto/static-files/
>
> Regards,
> Mudassar
>
> On Mon, Aug 8, 2016 at 1:58 AM, Timothy Steele <
> steeletimothy2...@gmail.com> wrote:
>
>>
>>
>> On Monday, August 8, 2016 at 1:16:57 AM UTC+1, Timothy Steele wrote:
>>>
>>> Please any time i try to load my Django admin panel the default CSS
>>> files does not load and even i have to refresh several time before i can
>>>  the css file will load, and even if i log in still the interface become
>>> different, it does not load the CSS files. I believe this is coming form
>>> the static files which i have not loaded but i did what ever i could and it
>>> did not work for me so i need  a help please.
>>> Please below is an attach file of screen shots i took
>>>
>>> Any way i am still a beginner
>>>
>>> THANKS
>>>
>>
>> (any way this is the best group i have join so far thanks to all of you)
>>
>> PLEASE MY FRIENDS I BEG
>> can you give me a step by step process to do this
>> thanks very mach
>>
>>
>>
>> --
>> 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/ms
>> gid/django-users/7f5ae2e5-11f7-429b-b4a3-78a8d36ef787%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/7f5ae2e5-11f7-429b-b4a3-78a8d36ef787%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/hiSv5Nf2z5M/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CANoUts6uCR1H5tAZaZ8x%2BfwN

Re: Please another problem

2016-08-08 Thread Timothy Steele


On Monday, August 8, 2016 at 10:07:30 AM UTC+1, Timothy Steele wrote:
>
> i have my sever running and every thing is work but at the bottom of the 
> pannel
> it give this error pasted below Please help me to solve this my friends 
> Performing system checks...
>
> System check identified no issues (0 silenced).
> August 08, 2016 - 08:39:33
> Django version 1.10, using settings 'conference.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [08/Aug/2016 08:39:36] "GET / HTTP/1.1" 200 1767
>
> *(THE ERROR STATE FROM HEAR)*
>
> Not Found: /favicon.ico
> [08/Aug/2016 08:39:36] "GET /favicon.ico HTTP/1.1" 404 1940
> Not Found: /favicon.ico
> [08/Aug/2016 08:39:37] "GET /favicon.ico HTTP/1.1" 404 1940
> [08/Aug/2016 08:39:42] "GET /admin/ HTTP/1.1" 200 4797
> [08/Aug/2016 08:39:53] "GET /admin/app/speaker/ HTTP/1.1" 200 4173
> [08/Aug/2016 08:39:53] "GET /admin/jsi18n/ HTTP/1.1" 200 3189
> [08/Aug/2016 08:39:55] "GET /admin/ HTTP/1.1" 200 4797
> [08/Aug/2016 08:39:59] "GET /admin/app/ HTTP/1.1" 200 2960
> [08/Aug/2016 08:39:59] "GET /static/admin/css/base.css HTTP/1.1" 304 0
> [08/Aug/2016 08:39:59] "GET /static/admin/css/dashboard.css HTTP/1.1" 304 0
> [08/Aug/2016 08:39:59] "GET /static/admin/css/fonts.css HTTP/1.1" 304 0
> [08/Aug/2016 08:39:59] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 
> 304 0
> [08/Aug/2016 08:39:59] "GET /static/admin/img/icon-changelink.svg 
> HTTP/1.1" 304 0
> [08/Aug/2016 08:40:02] "GET /admin/ HTTP/1.1" 200 4797
>
*THANK YOU VERY MACH I REALLY LIKE THE RESPONSE YOU HAVE GIVEN *
*AND I SAY BRAVO FOR THAT, THIS IS THE TYPE OF GROUP I ALWAYS LIKE TO JOIN *
*THANK YOU AGAIN AND AGAIN  *   (Andreas Kuhne May God Give you more 
knowledge)

-- 
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/2dd740cd-5f62-4354-abd8-bf8799f68f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Please another problem

2016-08-08 Thread Timothy Steele
i have my sever running and every thing is work but at the bottom of the 
pannel
it give this error pasted below Please help me to solve this my friends 
Performing system checks...

System check identified no issues (0 silenced).
August 08, 2016 - 08:39:33
Django version 1.10, using settings 'conference.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[08/Aug/2016 08:39:36] "GET / HTTP/1.1" 200 1767

*(THE ERROR STATE FROM HEAR)*

Not Found: /favicon.ico
[08/Aug/2016 08:39:36] "GET /favicon.ico HTTP/1.1" 404 1940
Not Found: /favicon.ico
[08/Aug/2016 08:39:37] "GET /favicon.ico HTTP/1.1" 404 1940
[08/Aug/2016 08:39:42] "GET /admin/ HTTP/1.1" 200 4797
[08/Aug/2016 08:39:53] "GET /admin/app/speaker/ HTTP/1.1" 200 4173
[08/Aug/2016 08:39:53] "GET /admin/jsi18n/ HTTP/1.1" 200 3189
[08/Aug/2016 08:39:55] "GET /admin/ HTTP/1.1" 200 4797
[08/Aug/2016 08:39:59] "GET /admin/app/ HTTP/1.1" 200 2960
[08/Aug/2016 08:39:59] "GET /static/admin/css/base.css HTTP/1.1" 304 0
[08/Aug/2016 08:39:59] "GET /static/admin/css/dashboard.css HTTP/1.1" 304 0
[08/Aug/2016 08:39:59] "GET /static/admin/css/fonts.css HTTP/1.1" 304 0
[08/Aug/2016 08:39:59] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 
304 0
[08/Aug/2016 08:39:59] "GET /static/admin/img/icon-changelink.svg HTTP/1.1" 
304 0
[08/Aug/2016 08:40:02] "GET /admin/ HTTP/1.1" 200 4797

-- 
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/bc139b06-c21d-4290-915f-4149ee3549a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please Can Some one Help me To get my static files load my default CSS files

2016-08-08 Thread Timothy Steele


On Monday, August 8, 2016 at 1:16:57 AM UTC+1, Timothy Steele wrote:
>
> Please any time i try to load my Django admin panel the default CSS files 
> does not load and even i have to refresh several time before i can  the css 
> file will load, and even if i log in still the interface become different, 
> it does not load the CSS files. I believe this is coming form the static 
> files which i have not loaded but i did what ever i could and it did not 
> work for me so i need  a help please.
> Please below is an attach file of screen shots i took 
>
> Any way i am still a beginner
>
> THANKS
>

(any way this is the best group i have join so far thanks to all of you)

PLEASE MY FRIENDS I BEG 
can you give me a step by step process to do this 
thanks very mach

 

-- 
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/7f5ae2e5-11f7-429b-b4a3-78a8d36ef787%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please Can Some one Help me To get my static files load my default CSS files

2016-08-08 Thread Timothy Steele
On Monday, August 8, 2016 at 1:16:57 AM UTC+1, Timothy Steele wrote:
>
> Please any time i try to load my Django admin panel the default CSS files 
> does not load and even i have to refresh several time before i can  the css 
> file will load, and even if i log in still the interface become different, 
> it does not load the CSS files. I believe this is coming form the static 
> files which i have not loaded but i did what ever i could and it did not 
> work for me so i need  a help please.
> Please below is an attach file of screen shots i took 
>
> Any way i am still a beginner
>
 

>
> THANKS
>

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


Please Can Some one Help me To get my static files load my default CSS files

2016-08-07 Thread Timothy Steele
Please any time i try to load my Django admin panel the default CSS files 
does not load and even i have to refresh several time before i can  the css 
file will load, and even if i log in still the interface become different, 
it does not load the CSS files. I believe this is coming form the static 
files which i have not loaded but i did what ever i could and it did not 
work for me so i need  a help please.
Please below is an attach file of screen shots i took 

Any way i am still a beginner

THANKS

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


Please this is the log in screen short.docx
Description: MS-Word 2007 document


Re: How to save a table in a cell in django models.

2015-12-02 Thread Timothy W. Cook
On Wed, Dec 2, 2015 at 2:27 AM, Billu  wrote:

> What I want to do is generate a HTML table (alongwith other data viz.
> images, text) when somebody opens a page.
>
> So how would I *save *a table, i.e, what would be the keyword for it eg.
> CharField, IntegerField.
>
> I've googled and people have written that you need to save XML data in the
> database cell. If so how to do that?
>
> Or should I just save comma separated text and work with that, although I
> guess that may be a little difficult as there are bullets and sub-bullets
> in one of the columns.
>
>
​If you are just generating a table to be included later in a web page, I
would store them in a  TextField.  If you are generating complete web pages
that you want to serve statically then you can use a ​FileField.


-- 

====
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Making a field readonly according to the user in admin.py

2015-11-18 Thread Timothy W. Cook
While Jani's admonishments might be considered 'best practice' in some
cases. Those do not always cover everyone's use case.

I solved a similar issue allowing users with the superuser role to have
edit access to some items that other staff do not have access to edit.

Use the get_form method of the ModelAdmin and select the form to call.

For example:
def get_form(self, request, obj=None, **kwargs):
if request.user.is_superuser:
kwargs['form'] = DMAdminSUForm
else:
kwargs['form'] = DMAdminForm

Then in each form you can set the readonly attributes and any other user
role specific functionality you need.

HTH,
Tim







On Wed, Nov 18, 2015 at 8:21 AM, Jani Tiainen  wrote:

> Hi,
>
> In general you shouldn't be even trying to do this in admin since it's not
> designed for this kind of functionality.
>
> Admin is just a datacentric tool to view your data. It's never been meant
> to help implementing any businesslogic. And basically you only should let
> people in admin that you trust full 100%.
>
> If you can't trust them (which is indicated by "readonly field"
> requirement) you should do custom view and templates for that. Generic
> class based views can greatly help you to achieve it, and most probably
> with really less effort than trying to do that in admin.
>
>
>
> On 18.11.2015 12:15, Victor wrote:
>
>> Dear experts,
>>
>> models.py
>>
>> class Book(models.Model):
>>  title = models.CharField(max_length=100)
>>  author = models.CharField(max_length=100)
>>  quantity = models.IntegerField(db_column='quantitity',default=0)
>>  class Meta:
>>  db_table="book"
>>
>> admin.py
>>
>> class BookOption(admin.ModelAdmin):
>>  list_display = ('title', 'author', 'quantity')
>>  fields=(('title', 'author'), ('quantity'))
>>  order_by= ['title', ]
>>
>> admin.site.register(Book,BookOption)
>>
>>
>> I'm trying to explain my problem with the simple example above.
>> Let's suppose that I have two staff users 'victor' and 'roby' and I want
>> that the fields 'author and 'quantity' be readonly when user 'roby' is
>> logged in and readwrite for user 'victor'
>> How can I achieve this result if possible with something of the following
>> simple kind
>>
>>
>> class BookOption(admin.ModelAdmin):
>>  if (user is 'roby'):
>> readonly_fields=['quantity',]
>>  list_display = ('title', 'author', 'quantity')
>>  fields=(('title', 'author'), ('quantity'))
>>  order_by= ['title', ]
>>   Thanks
>> Vittorio
>>
>> --
>
> Jani Tiainen
>
> --
> 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/564C5123.1020501%40gmail.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Django on CentOS

2015-11-10 Thread Timothy W. Cook
If you have the option use a different Linux distribution.  If you must use
CentOS this may help with getting Apache and Python (newer than 2.6)
working.
http://stackoverflow.com/questions/21158918/django-mod-wsgi-psycopg2-improperlyconfigured-error-loading-psycopg2-module


I see that since I had the original problem others have posted that there
are fixes for Python 3 and mod_wsgi.  It may work for you to use Python 3.x
???


On Tue, Nov 10, 2015 at 5:56 AM, Matthias Runge 
wrote:

> On 09/11/15 11:29, Robin Fourcade wrote:
> > Thanks for your answer James,
> > As this server is only the run this project, I can install another linux
> > distribution.
> > I'm able to install theses :
> >
> > *CentOS 6 minimal system (64 bits)*
> > Système de base openSUSE 13.1 (64 bits)
> > Système de base Debian 7 Wheezy (64 bits)
> > CentOS 6 avec Parallels Plesk Panel 12 (64 bits)
> > openSUSE 13.1 avec Parallels Plesk Panel 12 (64 bits)
> > Système de base ubuntu 14.04 (64 bits)
> >
> > Do you think it's better to install one or another ?
> >
> > Actually, I already tried on Debian 7 and I followed some tutorial but I
> > wasn't able to run the server neither. So if you know a great tutorial
> > which shows how to install&run a django project on one of theses
> > distributions, it would be perfect! :)
> >
> > Thanks again !
> >
> > Robin.
>
> CentOS 6 is fine, as you saw your developer server already worked.
>
> Looking at your project, I can not find a file
> pizzaclub.settings,
> but pizza_club.settings
>
> (see the '_' ?)
>
> Matthias
>
> --
> 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/5641A340.5080701%40matthias-runge.de
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3WqG%2BmR6sRsBecZPYYd%2B%3DUaz2o3%2BhmjJBEPf%3DgT5Yi6BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django w/ XML DOM

2015-09-18 Thread Timothy W. Cook
lxml - I assume using XPath will do what you want. I am not familiar with
XML cursor and jaxb.

On Fri, Sep 18, 2015 at 9:03 PM, Arnab Banerji  wrote:

> Hi - I am looking for a way to display XML documents in Django and get the
> xml section information from cursor location using XMLCursor like
> capabilities from XMLBeans (or its replacement, jaxb). Is there a supported
> library for that? Unfortunately, JSON would not be a good structure for
> this document, else my life would have been a lot simpler.
>
> Thanks
> -AB
>
> --
> 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/405884c6-e611-45ad-a8e1-2a081010012f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/405884c6-e611-45ad-a8e1-2a081010012f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Can u tell me how to build restful api project in django

2015-08-14 Thread Timothy W. Cook
Did you follow these instructions?
http://www.django-rest-framework.org/tutorial/quickstart/

Spend the time on the tutorial.  It will save you time in the long run.


On Fri, Aug 14, 2015 at 10:59 AM, HARSHIT GARG 
wrote:

> I am getting the following error:
>
> ImportError: rest_framework doesn't look like a module path
>
> --
> 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/765ed0a8-f900-49cd-b4e1-ce8c91e75ac0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/765ed0a8-f900-49cd-b4e1-ce8c91e75ac0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VZwt3_jhktVm2Df-L-XZ9Ut1Vqjx3L_oZxhvOGW4TkKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - Website Bootstrap Design Breaks For Production

2015-07-17 Thread Timothy W. Cook
You may find that even after running collectstatic the dev server doesn't
see the static files.
You can add the --insecure  option to runserver, with DEBUG=False and it
should work as expected.

On Fri, Jul 17, 2015 at 6:44 AM, Andreas Kuhne 
wrote:

> Hi,
>
> There is a difference to running the runserver in development and
> production mode. In development mode the server automatically serves all of
> you static files (JS and CSS). In production mode you should have a
> webserver in front of the uwsgi server that serves the python code. For
> example you can use Apache and nginx (see
> http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
> and https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/
> ).
>
> If you check in the output of the server you can see that the static files
> are not found([16/Jul/2015 17:31:20]"GET /static/css/bootstrap.min.css
> HTTP/1.1" 404 102). The 404 means that the file cannot be found, and you
> can't get a page with the correct stylesheet when the stylesheet is not
> found.
>
> You CAN try to run the following :
> python manage.py collectstatic
>
> In the project directory and create the static files, that then will be
> served from your runserver process.
>
> Regards,
>
> Andréas
>
> 2015-07-16 20:39 GMT+02:00 Chris Nowak :
>
>> I'm following the Try Django Tutorial #37 on Youtube and around the 11
>> minute mark, after the author sets DEBUG = False and ALLOWED_HOSTS =
>> ['*'] to put the website into production mode, he runs the server again
>> and the website appears nicely designed on his end. However, when I run it
>> again on my end while following along, the Bootstrap design of the
>> website completely falls apart with some images not even showing up.
>>
>> I'm suspecting that this has something to with the static_in_env vs.
>> static_in_pro when it comes development vs. production, but I'm not
>> sure, just a beginner. Also, the following is what I'm getting in my
>> command terminal:
>>
>>
>> [16/Jul/2015 17:31:20]"GET /static/css/bootstrap.min.css HTTP/1.1" 404 
>> 102[16/Jul/2015 17:31:20]"GET /static/css/custom.css HTTP/1.1" 404 
>> 95[16/Jul/2015 17:31:20]"GET /static/img/marketing1.jpg HTTP/1.1" 404 
>> 99[16/Jul/2015 17:31:20]"GET /static/css/navbar-static-top.css HTTP/1.1" 404 
>> 106[16/Jul/2015 17:31:20]"GET /static/img/mvp_landing_logo.png HTTP/1.1" 404 
>> 105[16/Jul/2015 17:31:20]"GET /static/js/bootstrap.min.js HTTP/1.1" 404 
>> 100[16/Jul/2015 17:31:20]"GET /static/js/ie10-viewport-bug-workaround.js 
>> HTTP/1.1" 404 115
>>
>>
>> I have attached screen shots of the website and how it's breaking. Any
>> help or advice on how to fix this issue is appreciated. 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/f5998fb8-3910-430b-a25b-8b48464f9c24%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f5998fb8-3910-430b-a25b-8b48464f9c24%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUbkwddYSeL21mboivH-EEONx8vRdnhr66px405bEo%3D-27w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUbkwddYSeL21mboivH-EEONx8vRdnhr66px405bEo%3D-27w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Recommend guide to setting up a production server with Django and Python 3

2015-07-10 Thread Timothy W. Cook
This is a couple of years old but I used it for a template and it works
great.

http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/


On Fri, Jul 10, 2015 at 8:42 AM, Christian Kleineidam <
christian.kleinei...@gmail.com> wrote:

> Is there a recommended guide to set up a new Django enviroment with Python
> 3?
> It seems like the official guide on https://docs.djangoproject.com/en/1.8/
> tells me to use a decidated server instead of letting django run the server
> itself but doesn't tell me how.
>
> --
> 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/97f71409-0e46-497f-b193-77ee65a98dfb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/97f71409-0e46-497f-b193-77ee65a98dfb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3UVPBt6q_2GRH4PLJ%3DXbQ_MW7sk1J0PV1%2B7zRPXF2da1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Testing Setup gives 500, but dev server works okay

2015-05-25 Thread Timothy W. Cook
I should add that the actual error is:

selenium.common.exceptions.NoSuchElementException: Message: Unable to
locate element: {"method":"id","selector":"id_login"}

because the main page never loads so it can't find the login button,


On Mon, May 25, 2015 at 12:29 PM, Timothy W. Cook  wrote:

> I have a project that I started, then decided I should apply a TDD
> approach.
>
> Well the user registration and login portion already works but I am
> attempting to add some tests to it.
> The user can register, is redirected back to the main page with a Login
> button.
>
> Here is the test code:
>
> def test_visitor_can_register_and_login_logout(self):
> self.browser.get(self.server_url)
> self.browser.find_element_by_id('id_register').click()
> self.browser.find_element_by_id('id_username').send_keys(TEST_USER)
> self.browser.find_element_by_id('id_email').send_keys(TEST_EMAIL)
>
> self.browser.find_element_by_id('id_password1').send_keys(TEST_PASSWORD)
>
> self.browser.find_element_by_id('id_password2').send_keys(TEST_PASSWORD)
> self.browser.find_element_by_id('submit_registration').click()
> time.sleep(10)
> ## Existing user is invited to login
> self.browser.find_element_by_id('id_login').click()
> self.browser.find_element_by_id('id_login').send_keys(TEST_USER)
>
> self.browser.find_element_by_id('id_password').send_keys(TEST_PASSWORD)
> self.browser.find_element_by_id('log_me_in').click()
>
> ## test user is logged in and can logout
> self.browser.find_element_by_id('id_logout').click()
> self.browser.find_element_by_tag_name('button').click()
> ##redirected back to main page
> self.browser.find_element_by_id('id_login')
>
> I see the main page load, the registration page loads and the inputs are
> filled in.
> When the submit_registion button is clicked I get a 500.  You can see I
> put a sleep in there just so I could see it and verify that the process
> isn't running too fast for the server to respond.
>
> I originally had the registration and login in separate tests but I
> understand that this might require TransactionTestCase ?  I am using
> from django.test import LiveServerTestCase in this class.
>
> I have one other test before that runs fine.
>
> Any ideas?  Tips on troubleshooting this functional test?
>
>
>
>
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3UetYF2s47x3KiY%3D%3DZ8%3DYpCu%3Dc3L10z-XHOxBfUsHnRDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Testing Setup gives 500, but dev server works okay

2015-05-25 Thread Timothy W. Cook
I have a project that I started, then decided I should apply a TDD
approach.

Well the user registration and login portion already works but I am
attempting to add some tests to it.
The user can register, is redirected back to the main page with a Login
button.

Here is the test code:

def test_visitor_can_register_and_login_logout(self):
self.browser.get(self.server_url)
self.browser.find_element_by_id('id_register').click()
self.browser.find_element_by_id('id_username').send_keys(TEST_USER)
self.browser.find_element_by_id('id_email').send_keys(TEST_EMAIL)

self.browser.find_element_by_id('id_password1').send_keys(TEST_PASSWORD)

self.browser.find_element_by_id('id_password2').send_keys(TEST_PASSWORD)
self.browser.find_element_by_id('submit_registration').click()
time.sleep(10)
## Existing user is invited to login
self.browser.find_element_by_id('id_login').click()
self.browser.find_element_by_id('id_login').send_keys(TEST_USER)

self.browser.find_element_by_id('id_password').send_keys(TEST_PASSWORD)
self.browser.find_element_by_id('log_me_in').click()

## test user is logged in and can logout
self.browser.find_element_by_id('id_logout').click()
self.browser.find_element_by_tag_name('button').click()
##redirected back to main page
self.browser.find_element_by_id('id_login')

I see the main page load, the registration page loads and the inputs are
filled in.
When the submit_registion button is clicked I get a 500.  You can see I put
a sleep in there just so I could see it and verify that the process isn't
running too fast for the server to respond.

I originally had the registration and login in separate tests but I
understand that this might require TransactionTestCase ?  I am using
from django.test import LiveServerTestCase in this class.

I have one other test before that runs fine.

Any ideas?  Tips on troubleshooting this functional test?






Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3Xv1Zz-6uSkUphtNa_kx-YbUbA2MOPn0wOUN-Bpm3sm%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Improve Performance in Admin ManyToMany

2015-05-20 Thread Timothy W. Cook
*SOLVED:*

The correct method name is *formfield_for_manytomany * instead of
*formfield_for_many_to_many*


*def formfield_for_manytomany(self, db_field, *args, **kwargs):*
*formfield = super(ClusterAdmin,
self).formfield_for_manytomany(db_field, *args, **kwargs)*
*if db_field.name <http://db_field.name> in
['dvboolean','dvuri','dvstring','dvcodedstring','dvidentifier','clusters','dvparsable','dvmedia','dvordinal','dvtemporal','dvcount','dvquantity','dvratio',]:*
*formfield.queryset =
formfield.queryset.select_related('prj_name')*
*return formfield*

Reduced the number of queries to 33 and the time to 182ms.

Awesome, thanks for the pointers.



On Sun, May 17, 2015 at 8:53 PM, Timothy W. Cook  wrote:

>
>
> On Sun, May 17, 2015 at 4:20 PM, Erik Cederstrand <
> erik+li...@cederstrand.dk> wrote:
>
>>
>> I just noticed you have a typo:
>>
>> if db_field.name in ['cluster', ...
>>
>> should be:
>>
>> if db_field.name in ['clusters', ...
>>
>> according to your model definition.
>>
>>
> ​Thanks Erik. Yes, that was a typo.  Unfortunately fixing it doesn't
> change anything though. ​  :-(
>
>
>
>
>
>
>> Erik
>>
>> --
>> 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/ED7D33CB-EE4B-451D-B00F-7B24BFAD7A90%40cederstrand.dk
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Improve Performance in Admin ManyToMany

2015-05-17 Thread Timothy W. Cook
On Sun, May 17, 2015 at 4:20 PM, Erik Cederstrand  wrote:

>
> I just noticed you have a typo:
>
> if db_field.name in ['cluster', ...
>
> should be:
>
> if db_field.name in ['clusters', ...
>
> according to your model definition.
>
>
​Thanks Erik. Yes, that was a typo.  Unfortunately fixing it doesn't change
anything though. ​  :-(






> Erik
>
> --
> 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/ED7D33CB-EE4B-451D-B00F-7B24BFAD7A90%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Improve Performance in Admin ManyToMany

2015-05-16 Thread Timothy W. Cook
On Sat, May 16, 2015 at 5:27 PM, Erik Cederstrand  wrote:

>
> > Den 15/05/2015 kl. 20.54 skrev Timothy W. Cook :
> >
> > def formfield_for_many_to_many(self, db_field, *args, **kwargs):
> > formfield = super(ClusterAdmin,
> self).formfield_for_many_to_many(db_field, *args, **kwargs)
> > if db_field.name in
> ['cluster','dvboolean','dvuri','dvstring','dvcodedstring','dvidentifier','dvparsable','dvmedia',
> >
> 'dvordinal','dvcount','dvquantity','dvratio','dvtemporal']:
> > formfield.queryset =
> formfield.queryset.select_related('project')
> > return formfield
> >
> >
> >
> > ​Each of the ManyToMany references have this in their model:
> >
> >
> > ​def __str__(self):
> > return self.prj_name.prj_name + ":" + self.data_name
>
> Are you sure you don't mean
>
>formfield.queryset.select_related('prj_name')
>
> If 'prj_name' is the FK on your m2m models, then that's what should be
> passed to select_related()
>
> Django 1.8 should catch this for you, if 'project' isn't also a FK on your
> model.
>
>
​Project is the model used as the foreign key. ​
But yes, I suppose that prj_name is the correct field name to use there.
However, I still have 4520 queries executing.  Before that change it was
4521.
Strange that it would drop by only one query.  I changed it back to
'project' just to be sure I remembered correctly and yes it went back to
4521.

The queries look like this:

*SELECT* "ccdgen_cluster"."id"
<http://127.0.0.1:8000/admin/ccdgen/cluster/209/#> *FROM*
"ccdgen_cluster" *INNER
JOIN* "ccdgen_cluster_clusters" *ON* ( "ccdgen_cluster"."id" =
"ccdgen_cluster_clusters"."to_cluster_id" ) *INNER JOIN* "ccdgen_project"
*ON* ( "ccdgen_cluster"."prj_name_id" = "ccdgen_project"."prj_name" )
*WHERE* "ccdgen_cluster_clusters"."from_cluster_id" = 209 *ORDER* *BY*
"ccdgen_project"."prj_name" *ASC*, "ccdgen_cluster"."cluster_subject" *ASC*

*...*


*SELECT "ccdgen_project"."id", "ccdgen_project"."pgroup_id",
"ccdgen_project"."prj_name", "ccdgen_project"."description",
"ccdgen_project"."rm_version_id"
<http://127.0.0.1:8000/admin/ccdgen/cluster/209/#> FROM
"ccdgen_project" WHERE "ccdgen_project"."prj_name"
= 'Brain Tumors'*

*Most take between .35 and .9 seconds.  *
*Except this one took 17 seconds.  No idea why except possibly memory
swapping or something at that point?*
*It seems to be just like many of the others. *

*SELECT •••
<http://127.0.0.1:8000/admin/ccdgen/cluster/209/#> FROM
"ccdgen_dvtemporal" INNER
JOIN "ccdgen_project" ON ( "ccdgen_dvtemporal"."prj_name_id" =
"ccdgen_project"."prj_name" ) ORDER BY "ccdgen_project"."prj_name" ASC,
"ccdgen_dvtemporal"."data_name" ASC*

These are all times running with the dev server on a laptop.  They do not
take that long on a small AWS instance.
*But still too long to be friendly to most users. *

*Thanks for any other insight. *

*--Tim*







> Erik
>
> --
> 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/D28F7970-28EB-46DE-9FD2-3BD3F63A085E%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: File Upload in Django

2015-05-16 Thread Timothy W. Cook
The official docs are a good place to start
https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/

This GitHub example is about the newest one available showing the changes
in recent Django versions
https://github.com/axelpale/minimal-django-file-upload-example



On Sat, May 16, 2015 at 5:33 AM, SUBHABRATA BANERJEE <
subhabrata.bane...@gmail.com> wrote:

> Dear Group,
>
> I want to upload file and form in Django. I am using Django 1.8 on Windows
> 2.7+ on Windows 7 Professional.
> I am bit new and I was confused how may I upload file and form in Django.
> If anyone may kindly show me an example tutorial. I tried some examples on
> Github and stackoverflow but not
> of much help.
>
> Regards,
> Subhabrata Banerjee.
>
> --
> 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/e94e0724-f243-43d2-834f-f7a41652fcac%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e94e0724-f243-43d2-834f-f7a41652fcac%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Improve Performance in Admin ManyToMany

2015-05-15 Thread Timothy W. Cook
On Fri, May 15, 2015 at 7:25 AM, Erik Cederstrand  wrote:

>
> > I wonder if there is another approach that I can use to solve this?
>
> Does the suggestion to append select_related() / prefetch_related() to the
> queryset in your admin view not work?
>

​If I implemented it correctly, it doesn't have any effect.  I ​get the
same number of queries reported by DjDT and effectively the same amount of
time.

The model called Cluster is the most egregious.
Model:

*class Cluster(Item):*
*"""*
*The grouping variant of Item, which may contain further instances of
Item, in an ordered list. This*
*provides the root Item for potentially very complex structures.*
*"""*
*cluster_subject = models.CharField(_('cluster
subject'),max_length=110, help_text="Enter a text name for this subject of
this cluster.")*
*clusters = models.ManyToManyField('Cluster',help_text="Select zero or
more Clusters to include in this Cluster. You cannot put a Cluster inside
itself, it will be ignored if you select itself.", blank=True)*
*dvboolean = models.ManyToManyField(DvBoolean,
related_name='%(class)s_related', help_text="Select zero or more booleans
to include in this Cluster.", blank=True)*
*dvuri = models.ManyToManyField(DvURI,
related_name='%(class)s_related', help_text="Select zero or more uris to
include in this Cluster.", blank=True)*
*dvstring = models.ManyToManyField(DvString,
related_name='%(class)s_related', help_text="Select zero or more strings to
include in this Cluster.", blank=True)*
*dvcodedstring = models.ManyToManyField(DvCodedString,
related_name='%(class)s_related', help_text="Select zero or more coded
strings to include in this Cluster.", blank=True)*
*dvidentifier = models.ManyToManyField(DvIdentifier,
related_name='%(class)s_related', help_text="Select zero or more
identifiers to include in this Cluster.", blank=True)*
*dvparsable = models.ManyToManyField(DvParsable,
related_name='%(class)s_related', help_text="Select zero or more parsables
to include in this Cluster.", blank=True)*
*dvmedia = models.ManyToManyField(DvMedia,
related_name='%(class)s_related', help_text="Select zero or more media
items to include in this Cluster.", blank=True)*
*dvordinal = models.ManyToManyField(DvOrdinal,
related_name='%(class)s_related', help_text="Select zero or more ordinals
to include in this Cluster.", blank=True)*
*dvcount = models.ManyToManyField(DvCount,
related_name='%(class)s_related', help_text="Select zero or more counts to
include in this Cluster.", blank=True)*
*dvquantity = models.ManyToManyField(DvQuantity,
related_name='%(class)s_related', help_text="Select zero or more quantity
items to include in this Cluster.", blank=True)*
*dvratio = models.ManyToManyField(DvRatio,
related_name='%(class)s_related', help_text="Select zero or more ratios to
include in this Cluster.", blank=True)*
*dvtemporal = models.ManyToManyField(DvTemporal,
related_name='%(class)s_related', help_text="Select zero or more temporal
items to include in this Cluster.", blank=True)*

*def __str__(self):*
*return self.prj_name.prj_name + ":" + self.cluster_subject*




Model Admin:

*class ClusterAdmin(admin.ModelAdmin):*
*list_filter = ['prj_name__rm_version__version_id','prj_name',]*
*search_fields = ['cluster_subject','ct_id']*
*ordering = ['prj_name','cluster_subject']*
*actions = [make_published, unpublish, copy_cluster]*
*readonly_fields = ['published','schema_code','xqr_code','xqw_code',]*
*filter_horizontal =
['dvboolean','dvuri','dvstring','dvcodedstring','dvidentifier','clusters','dvparsable','dvmedia','dvordinal','dvtemporal','dvcount','dvquantity','dvratio',]*
*form = ClusterAdminForm*

*def formfield_for_many_to_many(self, db_field, *args, **kwargs):*
*formfield = super(ClusterAdmin,
self).formfield_for_many_to_many(db_field, *args, **kwargs)*
*if db_field.name <http://db_field.name> in
['cluster','dvboolean','dvuri','dvstring','dvcodedstring','dvidentifier','dvparsable','dvmedia',*
*
 'dvordinal','dvcount','dvquantity','dvratio','dvtemporal']:*
*formfield.queryset =
formfield.queryset.select_related('project')*
*return formfield*



​Each of the ManyToMany references have t

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Timothy W. Cook
That is exactly the problem Simon.  Everyone of those models reference a
model called Project.  I did this so that when the items are displayed in
the selects, the user knows which project it is from.  In the interim I
guess I'll remove the call to Project from the __str__

I wonder if there is another approach that I can use to solve this?

Thanks,
Tim

On Thu, May 14, 2015 at 12:16 PM, Simon Charette 
wrote:

> I meant
>
> if db_field.name == 'bars':
>
> Sorry for noise...
>
>
> Le jeudi 14 mai 2015 11:15:49 UTC-4, Simon Charette a écrit :
>>
>> The last example should read:
>>
>> if db_field.name == 'baz':
>>
>>
>>
>> Le jeudi 14 mai 2015 11:14:24 UTC-4, Simon Charette a écrit :
>>>
>>> It's a bit hard to tell without your model definition and the executed
>>> queries but is it possible that the string representation method (__str__,
>>> __unicode__) of one the models referenced by a M2M access another related
>>> model during construction?
>>>
>>> e.g.
>>>
>>> from django.db import models
>>>
>>> class Foo(models.Model):
>>> pass
>>>
>>> class Bar(models.Model):
>>> foo = models.ForeignKey(Foo)
>>>
>>> def __str__(self):
>>> return "Foo %s" % self.foo
>>>
>>> class Baz(models.Model):
>>> bars = models.ManyToManyField(Bar)
>>>
>>> Here the Bar model uses the Foo related model for string representation
>>> construction and will result in N + 1 queries (N equals the number of Bar
>>> objects) if the Baz.bars fields is displayed in the admin. To make sure
>>> only one query is executed you must make sure Baz.bars are selected with
>>> their related Foo objects:
>>>
>>> from django.contrib import admin
>>>
>>> class BazAdmin(admin.ModelAdmin):
>>> def formfield_for_many_to_many(self, db_field, *args, **kwargs):
>>> formfield = super(BazAdmin, self).formfield_for_many_to_many(
>>> db_field, *args, **kwargs)
>>> if db_field.name == 'baz':
>>> formfield.queryset = formfield.queryset.select_related('foo'
>>> )
>>> return formfield
>>>
>>> Simon
>>>
>>> Le jeudi 14 mai 2015 07:29:36 UTC-4, Timothy W. Cook a écrit :
>>>>
>>>> It isn't that the individual queries are very slow. But that there are
>>>> so many of them. Attached is a screenshot of DjDT.
>>>> I see that I am not using a cache at all.  This was after doing a
>>>> reload of the same standard Django admin/change_form.html.
>>>>
>>>>
>>>> On Wed, May 13, 2015 at 1:58 PM, Tim Graham  wrote:
>>>>
>>>>> Are you sure it's the query that's slow and not the template rendering
>>>>> and/or JavaScript performance?
>>>>>
>>>>>
>>>>> On Wednesday, May 13, 2015 at 12:32:50 PM UTC-4, Timothy W. Cook wrote:
>>>>>>
>>>>>> I have a model with 13 M2M relations and some of those have a few
>>>>>> thousand instances.
>>>>>> This renders rather slowly in the Admin.
>>>>>>
>>>>>> Thinking about improvements I wonder if it will help to setup
>>>>>> prefetch_related queries
>>>>>>
>>>>>> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#prefetch-related
>>>>>>
>>>>>> inside a  formfield_for_manytomany method?
>>>>>>
>>>>>>
>>>>>> https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_manytomany
>>>>>>
>>>>>> ​I haven't tried it yet and am not even sure how to go about it.  But
>>>>>> if experienced developers think it will work, I'll give it a shot.
>>>>>>
>>>>>> Thoughts? ​
>>>>>>
>>>>>>
>>>>>> 
>>>>>> Timothy Cook
>>>>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>>>>> MLHIM http://www.mlhim.org
>>>>>>
>>>>>>   --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Timothy W. Cook
It isn't that the individual queries are very slow. But that there are so
many of them. Attached is a screenshot of DjDT.
I see that I am not using a cache at all.  This was after doing a reload of
the same standard Django admin/change_form.html.


On Wed, May 13, 2015 at 1:58 PM, Tim Graham  wrote:

> Are you sure it's the query that's slow and not the template rendering
> and/or JavaScript performance?
>
>
> On Wednesday, May 13, 2015 at 12:32:50 PM UTC-4, Timothy W. Cook wrote:
>>
>> I have a model with 13 M2M relations and some of those have a few
>> thousand instances.
>> This renders rather slowly in the Admin.
>>
>> Thinking about improvements I wonder if it will help to setup
>> prefetch_related queries
>>
>> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#prefetch-related
>>
>> inside a  formfield_for_manytomany method?
>>
>>
>> https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_manytomany
>>
>> ​I haven't tried it yet and am not even sure how to go about it.  But if
>> experienced developers think it will work, I'll give it a shot.
>>
>> Thoughts? ​
>>
>>
>> 
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>   --
> 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/58f721ad-2ee4-4016-ac6f-b48661c4ce5b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/58f721ad-2ee4-4016-ac6f-b48661c4ce5b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3XABUDKS0AVsi4Y%3Dz%2BqBiB5veYkgM56eoeEP_3DBS7DOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Improve Performance in Admin ManyToMany

2015-05-13 Thread Timothy W. Cook
I have a model with 13 M2M relations and some of those have a few thousand
instances.
This renders rather slowly in the Admin.

Thinking about improvements I wonder if it will help to setup
prefetch_related queries
https://docs.djangoproject.com/en/1.8/ref/models/querysets/#prefetch-related

inside a  formfield_for_manytomany method?

https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_manytomany

​I haven't tried it yet and am not even sure how to go about it.  But if
experienced developers think it will work, I'll give it a shot.

Thoughts? ​


========
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3Xe-2zSuNzo7MoLxsGHsKRz030GwP%2BjoEm0JjjwMvfgAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Stale contenttype

2015-05-06 Thread Timothy W. Cook
Django 1.8.1, PostgreSQL 9.3, Python 3.4, Ubuntu

I have a project that started under Django 1.4 and I have been migrating
through the updates as they were published.

At one point (I think under Django 1.5) I installed django-authtools
(currently at 1.2.0)

I am of course using Django migrations now instead of South as I was under
previous Django versions.

When I do migrations now I cannot complete a migration that removes tables
from my app because of this stale contentype problem.
Other things like modifying a model work okay.  When I run migrate I get
this:
-
Operations to perform:
  Synchronize unmigrated apps: paypal_connect, authtools, staticfiles,
admindocs, messages, debug_toolbar
  Apply all migrations: sites, sessions, auth, admin, ccdgen, contenttypes
Synchronizing apps without migrations:
  Creating tables...
Running deferred SQL...
  Installing custom SQL...
Running migrations:
  No migrations to apply.
The following content types are stale and need to be deleted:

auth | user

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

-

If I say I can't run the migrations on my app that delete tables.

If I say yes then I get this error.

django.db.utils.IntegrityError: update or delete on table "auth_permission"
violates foreign key constraint
"auth_user_user_permissions_permission_id_fkey" on table
"auth_user_user_permissions"
DETAIL:  Key (id)=(211) is still referenced from table
"auth_user_user_permissions".

​BUT! the tables were actually deleted from my app.  and I do not get any
warning about pending migrations.

Now the tables that I deleted are are being shown as stale contenttypes as
well.  But apparently they are all still referenced
from "auth_user_user_permissions" and violate the foreign key constraint.

So, how do I fix this?  Do I need to manually remove them from the
database?




Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3XaRkgkxMZWD4eDFSpp4q%2B3e%3D6etSroPxYH%2Bt%2B8_5cpvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin Inlines

2015-04-25 Thread Timothy W. Cook
For reference.  My mistake is that I really have a ManyToMany relationship
and I used this
http://www.mc706.com/tip_trick_snippets/18/django-manytomany-inline-admin/
to solve the problem.

Thanks to Ryan McDevitt.




On Sat, Apr 25, 2015 at 3:11 PM, Timothy W. Cook  wrote:

> The usage of AdminInlines seems backwards to me.
>
> At least in the use case I have.
>
> I have two  models:
>
> DvInterval:
> lower = models.CharField(max_length=110)
> upper = models.CharField(max_length=110)
> ...
>
>
>  ReferenceRange:
> ​  ​
> ​ ​   ...
>
> ​data_range = models.ForeignKey(DvInterval)
>
>
>
> ​Since a ReferenceRange may have many DvIntervals defined I would like to
> be able to edit them on the ReferenceRange admin page in a StackedInline.
> ​
> Kind of makes sense, right?  Add the intervals for this range.  At least
> that is what my users want.
>
> But the functionality of inlines wants me to put the ReferenceRange(s) on
> the DvIntervals page.  Most intervals will only be on one ReferenceRange
> but a ReferenceRange may have several intervals.
>
> Where is my modeling mistake?
>
> Thanks.
>
>
>
>
>
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VBk%2BKnFEUiBsVZ-r32ZEW75K0b_RgqZHheBTY2ik%2BDtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Admin Inlines

2015-04-25 Thread Timothy W. Cook
The usage of AdminInlines seems backwards to me.

At least in the use case I have.

I have two  models:

DvInterval:
lower = models.CharField(max_length=110)
upper = models.CharField(max_length=110)
...


 ReferenceRange:
​  ​
​ ​   ...

​data_range = models.ForeignKey(DvInterval)



​Since a ReferenceRange may have many DvIntervals defined I would like to
be able to edit them on the ReferenceRange admin page in a StackedInline.
​
Kind of makes sense, right?  Add the intervals for this range.  At least
that is what my users want.

But the functionality of inlines wants me to put the ReferenceRange(s) on
the DvIntervals page.  Most intervals will only be on one ReferenceRange
but a ReferenceRange may have several intervals.

Where is my modeling mistake?

Thanks.







Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3WHUs_rgzf0ZJcnKmw0M-6SemsC_C0tN79DTpwqeA-NLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrations During Development

2015-04-25 Thread Timothy W. Cook
On Sat, Apr 25, 2015 at 2:15 PM, Javier Guerra Giraldez 
wrote:

>
>

> with South i used to save them to the repo too and push whole to
> production.  haven't tried Django migrations yet; is there any
> difference that make this more appropriate?
>
>
​Hmmm, good question. That was kind of my question. With South I always
saved them.  This is my first project with using Django migrations.  There
doesn't seem to be much difference. ​



> if you don't store migrations, then you have to generate them on each
> production update, right?  if so, wouldn't they count as untested
> code?  how about manually tweaked, or data migrations?
>
>
​That will certainly be true once you start using a staging or production
server.
But before they they are just a kind left over creative ideas.  :-)  Not
really useful for anything in the future, AFAICS.

​






Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VL4HEPW%2BFLAgRsh0Qfhk_Kh98%2BtO%3DyG1wN%3Dy0-C1n%3DJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrations During Development

2015-04-25 Thread Timothy W. Cook
On Sat, Apr 25, 2015 at 9:48 AM, Jorge Andrés Vergara Ebratt <
javebr...@gmail.com> wrote:

> Are you using version control like GIT? I save the migration folder with
> the __init__.py in GIT, nothing else, because al the migrations will be
> diferent in the diferent servers.
>
>
​This is probably what I should have done. I have been saving them all to
the git repo.

I will likely delete them from git before I start deploying to other
machines and setup git to not track anything except the __init__.py

​





> On Sat, Apr 25, 2015, 7:45 AM Filipe Ximenes 
> wrote:
>
>> You should keep all project migrations, they will be used to update the
>> database everytime a change is made. This applies to your local project,
>> the staging server (if you have one) and your production server.
>> If you are worried about having to many migrations, you can delete the
>> ones that were not applied in other machines, and generate a single one
>> with all the changes.
>>
>> About the database, it can be deleted, but you don't need to do this,
>> your database data should only exist in your computer and not in the Django
>> project you are deploying.
>>
>> On Sat, Apr 25, 2015 at 9:26 AM, Timothy W. Cook  wrote:
>>
>>> Django 1.8  Python 3.4 PostgreSQL 9.3
>>>
>>> During development I am creating several migrations. It seems
>>> unnecessary to keep these since they only exist on my dev machine.
>>> Any data that I have created can be thrown away too.
>>>
>>> Is it safe to delete these migrations  (and the database) before
>>> deploying to the next stage for testing by users?
>>>
>>>
>>> --
>>>
>>> 
>>> Timothy Cook
>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>> MLHIM http://www.mlhim.org
>>>
>>>  --
>>> 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/CA%2B%3DOU3WNb8XWUWLyN%2B7fq4u7Er3dczOqgBKLODdVnE3cLxOr-g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WNb8XWUWLyN%2B7fq4u7Er3dczOqgBKLODdVnE3cLxOr-g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>>
>> *Filipe Ximenes*+55 (81) 8245-9204
>>
>> *Vinta Software Studio*http://www.vinta.com.br
>>
>> --
>> 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/CAA-QWB2RW_39b-8nm0Jm%2BAg9%2Bc%3DV0F4%3Dnm%3D%2B3DM7U-f3njV%3DNw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAA-QWB2RW_39b-8nm0Jm%2BAg9%2Bc%3DV0F4%3Dnm%3D%2B3DM7U-f3njV%3DNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAeX05H23hsbciqm%3DXn-PgcGpsA-ezL2Pnx4joP6rWJ%2Bkeirgw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAeX05H23hsbciqm%3DXn-PgcGpsA-ezL2Pnx4joP6rWJ%2Bkeirgw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VvgjMDfAx8QKaepk7%2BomROnE9%3Dk6P67FYuU0obTNoo7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Migrations During Development

2015-04-25 Thread Timothy W. Cook
Django 1.8  Python 3.4 PostgreSQL 9.3

During development I am creating several migrations. It seems unnecessary
to keep these since they only exist on my dev machine.
Any data that I have created can be thrown away too.

Is it safe to delete these migrations  (and the database) before deploying
to the next stage for testing by users?


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3WNb8XWUWLyN%2B7fq4u7Er3dczOqgBKLODdVnE3cLxOr-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Version

2015-04-21 Thread Timothy W. Cook
I really doubt a new user wants to install 1.4

After getting your virtualenv setup then use:

pip install django

to install the latest version.



On Tue, Apr 21, 2015 at 9:12 AM, Andreas Kuhne 
wrote:

> Hi,
>
> First of all, don't use apt-get to install django, you will never get the
> version you want. Use a virtualenv instead: Google virtualenv install
> ubuntu (and your ubuntu version). Create a virtualenvironment and install
> django with pip. Using pip you can install whatever version of django you
> want, for example django 1.4: "pip install django==1.4.20". I would
> recommend that you look for a good tutorial for using virtualenv in ubuntu.
>
> Regards,
>
> Andréas
>
>
> 2015-04-21 13:52 GMT+02:00 Parikshit Mishra :
>
>> I am working on ubuntu,python version is 1.3.1,I have installed it with
>> the help of "apt-get install python-django" command .I want to set up MySQL
>> database. Also I want to upgrade the version of django to latest version..
>> How to do this ?
>>
>> Please help me.
>>
>>
>> Thank yo so muchh ..!!
>>
>>
>>
>> On Tuesday, 21 April 2015 16:26:38 UTC+5:30, Parikshit Mishra wrote:
>>>
>>> hello  everyone.
>>>
>>> I hv installed django but it is version 1.3.1.Please tell me how to
>>> update it to 1.4 .Also how to install data base pls help 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/604630b9-f0f5-499a-8250-38d35807a190%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/604630b9-f0f5-499a-8250-38d35807a190%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUbm2oT%3D5YTzMJfkNabB_ntSM5fb1FSczr8xe6miSctMDVw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUbm2oT%3D5YTzMJfkNabB_ntSM5fb1FSczr8xe6miSctMDVw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VUuRDCuQ-Ai%3D%2Brsx0bK2X%2BH_-aUaiVx_X0aK3yJyA7hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Timothy W. Cook
On Sun, Jan 18, 2015 at 5:35 PM, Collin Anderson 
wrote:

> Hi,
>
> Rename your __unicode__ to __str__. Python 3 doesn't know what
> "__unicode__" is. :)
>
>
​Yep, that did it.​  Interesting that it was working up until now and that
my AJAX calls worked either way.  



> You say this works fine:
> >>>
> ​​
> from ccdgen.models import DvBoolean,DvAny, Common, Project
> >>> pcts = DvBoolean.objects.all()
> >>> for p in pcts:
> ...   print(p.prj_name.prj_name)
>
> But django is expecting this also to work:
> >>> pcts = DvBoolean.objects.all()
> >>> for p in pcts:
> ...   print(p.prj_name)
>

​It does now.  It did not before the change above.​


​Thanks,
Tim







Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Timothy W. Cook
On Sat, Jan 17, 2015 at 11:49 AM, Collin Anderson 
wrote:

> Hi,
>
> Did you also switch to Python 3?
>

​Yes.

Well, I didn't switch. I have been using Python 3 for quite some time.
Even before it was officially supported.
​


> It doesn't seem to be using your __unicode__ method at all.
> If you query one of these Projects in manage.py shell, do they show the
> project name?
>

​As I said before, my views that use AJAX to return data from queries still
work just as before.  But yes, in the manage.py shell I can import the
models and print the names.

>>> from ccdgen.models import DvBoolean,DvAny, Common, Project
>>> pcts = DvBoolean.objects.all()
>>> for p in pcts:
...   print(p.prj_name.prj_name)

caBIG
caBIG
caBIG
caBIG
caBIG
caBIG
caBIG

...





> Are you sure that the __unicode__ method is actually attached to your
> model?
>
>
I am not exactly sure what you mean by that question; attached?​Here is
the code: ​

class Project(models.Model):
"""
Every item created in CCDGEN must be assigned to a Project when
created. All items (except CCD) may be
reused in multiple CCDs. However, this does not change the original
Project.
The Allowed Groups field contains each of the User Groups allowed to
see each item with this Project name.
The User Group, Open, is assigned to every user. So if you assign the
Open group as one of the allowed groups,
all CCDGEN users will see this item.
"""
pgroup = models.ForeignKey(Group, verbose_name='Primary Group',
related_name='primarygroup', null=True)
prj_name = models.CharField(_("project name"), max_length=110,
unique=True, db_index=True, help_text=_('Enter the name of your project.'))
description = models.TextField(_("project description"), blank=True,
help_text=_('Enter a description or explaination of an acronym of the
project.'))
rm_version = models.ForeignKey(RMversion, verbose_name=_('rm version'),
related_name='%(class)s_related', help_text=_('Choose the version of the
MLHIM Reference Model you are using.'))
allowed_groups = models.ManyToManyField(Group, verbose_name=_('allowed
groups'), related_name='%(class)s_related', help_text=_('Choose the groups
that are allowed to work in this project.'))

def __unicode__(self):
return self.prj_name


class Meta:
verbose_name = _("Project")
verbose_name_plural = _("Projects")
ordering = ['prj_name']




> Also, FYI, to_field="prj_name" means you can't easily change the name of
> the project.
>
>
​Yes, Once created the name cannot be changed, and once an item is assigned
to a project the attached items are immutable.

Thanks,
Tim




> Collin
>
> On Friday, January 16, 2015 at 3:14:55 PM UTC-5, Timothy W. Cook wrote:
>>
>> I should also mention that I have some AJAX calls for the same
>> information and they still work fine.  So I am quite certain it is in the
>> Admin templates or the Admin properties definitions.
>>
>> On Fri, Jan 16, 2015 at 5:56 PM, Timothy W. Cook  wrote:
>>
>>> Is this a bug or did I miss something in the release notes?
>>>
>>> ​Moving from 1.6.4 to 1.7.3  the listing in the Admin UI is not
>>> resolving a related field now.  There are not any model changes involved.
>>>
>>> Attached are two screen shots named for the versions.
>>>
>>> I haven't changed the admin code either.  For the screen shots the admin
>>> code is:
>>>
>>> ​class DvBooleanAdmin(admin.ModelAdmin):
>>> list_filter = ['prj_name__rm_version__version_id','prj_name',]
>>> search_fields = ['data_name','ct_id']
>>> ordering = ['prj_name','data_name']
>>> actions = [make_published, unpublish, copy_dt, republish]
>>> readonly_fields = ['published','schema_code','r_
>>> code','xqr_code','xqw_code',]
>>> def get_form(self, request, obj=None, **kwargs):
>>> try:
>>> if obj.published:
>>> self.readonly_fields = ['prj_name','published','lang'
>>> ,'schema_code','data_name','valid_trues','valid_falses','
>>> description','sem_attr','resource_uri','asserts','xqr_code','xqw_code',]
>>> except (AttributeError, TypeError) as e:
>>> self.readonly_fields = ['published'

Re: Django Admin UI Bug - 1.7.3

2015-01-16 Thread Timothy W. Cook
I should also mention that I have some AJAX calls for the same information
and they still work fine.  So I am quite certain it is in the Admin
templates or the Admin properties definitions.

On Fri, Jan 16, 2015 at 5:56 PM, Timothy W. Cook  wrote:

> Is this a bug or did I miss something in the release notes?
>
> ​Moving from 1.6.4 to 1.7.3  the listing in the Admin UI is not resolving
> a related field now.  There are not any model changes involved.
>
> Attached are two screen shots named for the versions.
>
> I haven't changed the admin code either.  For the screen shots the admin
> code is:
>
> ​class DvBooleanAdmin(admin.ModelAdmin):
> list_filter = ['prj_name__rm_version__version_id','prj_name',]
> search_fields = ['data_name','ct_id']
> ordering = ['prj_name','data_name']
> actions = [make_published, unpublish, copy_dt, republish]
> readonly_fields =
> ['published','schema_code','r_code','xqr_code','xqw_code',]
> def get_form(self, request, obj=None, **kwargs):
> try:
> if obj.published:
> self.readonly_fields =
> ['prj_name','published','lang','schema_code','data_name','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts','xqr_code','xqw_code',]
> except (AttributeError, TypeError) as e:
> self.readonly_fields =
> ['published','schema_code','r_code','xqr_code','xqw_code',]
> return super(DvBooleanAdmin, self).get_form(request, obj, **kwargs)
>
> fieldsets = (
> (None, {'classes':('wide',),
>
>  
> 'fields':('published','prj_name','data_name','lang','valid_trues','valid_falses')}),
> ("Additional Information ", {'classes':('wide',),
>
>  'fields':('description','sem_attr','resource_uri','asserts',)}),
> ("PCT Code (read-only)", {'classes':('collapse',),
>
>  'fields':('schema_code','r_code','xqr_code','xqw_code',)}),
>
> )
> list_display = ('data_name','prj_name','published',)
> admin.site.register(DvBoolean, DvBooleanAdmin)
>
> ​In the model for the displayed admin:
> ​prj_name = models.ForeignKey(Project, verbose_name=_("Project Name"),
> to_field="prj_name", help_text=_('Choose the name of your Project.'))
>
> ​and the related field in Project is:
> prj_name = models.CharField(_("project name"), max_length=110,
> unique=True, db_index=True, help_text=_('Enter the name of your project.'))
>
> ...
>
> def __unicode__(self):
> return self.prj_name
> ​
>
>
> ​Any ideas?​
>
> Should I file a bug report?
>
> ​Thanks,
> Tim
> ​
>
>
>
>
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Django Admin UI Bug - 1.7.3

2015-01-16 Thread Timothy W. Cook
Is this a bug or did I miss something in the release notes?

​Moving from 1.6.4 to 1.7.3  the listing in the Admin UI is not resolving a
related field now.  There are not any model changes involved.

Attached are two screen shots named for the versions.

I haven't changed the admin code either.  For the screen shots the admin
code is:

​class DvBooleanAdmin(admin.ModelAdmin):
list_filter = ['prj_name__rm_version__version_id','prj_name',]
search_fields = ['data_name','ct_id']
ordering = ['prj_name','data_name']
actions = [make_published, unpublish, copy_dt, republish]
readonly_fields =
['published','schema_code','r_code','xqr_code','xqw_code',]
def get_form(self, request, obj=None, **kwargs):
try:
if obj.published:
self.readonly_fields =
['prj_name','published','lang','schema_code','data_name','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts','xqr_code','xqw_code',]
except (AttributeError, TypeError) as e:
self.readonly_fields =
['published','schema_code','r_code','xqr_code','xqw_code',]
return super(DvBooleanAdmin, self).get_form(request, obj, **kwargs)

fieldsets = (
(None, {'classes':('wide',),

 
'fields':('published','prj_name','data_name','lang','valid_trues','valid_falses')}),
("Additional Information ", {'classes':('wide',),

 'fields':('description','sem_attr','resource_uri','asserts',)}),
("PCT Code (read-only)", {'classes':('collapse',),

 'fields':('schema_code','r_code','xqr_code','xqw_code',)}),

)
list_display = ('data_name','prj_name','published',)
admin.site.register(DvBoolean, DvBooleanAdmin)

​In the model for the displayed admin:
​prj_name = models.ForeignKey(Project, verbose_name=_("Project Name"),
to_field="prj_name", help_text=_('Choose the name of your Project.'))

​and the related field in Project is:
prj_name = models.CharField(_("project name"), max_length=110,
unique=True, db_index=True, help_text=_('Enter the name of your project.'))

...

def __unicode__(self):
return self.prj_name
​


​Any ideas?​

Should I file a bug report?

​Thanks,
Tim
​






Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Model to create forms

2015-01-09 Thread Timothy W. Cook
I think you are looking for a way to provide an abstraction like this
http://django-forms-builder.readthedocs.org/en/latest/


On Thu, Jan 8, 2015 at 6:52 PM, Lorenzo Bernardi <
lorenzo.berna...@lpn.cnrs.fr> wrote:

>
> Hello,
>
>> this is what _relational_ databases are built for.  if you have two
>> tables, one for the description of the experiment (one record per
>> experiment), and another for the statistics (one record per data
>> sample, with a foreign key to the experiment record); then fetching
>> the description of the experiment, plus all the related data will be
>> much faster, simpler, more compact and all-around more efficient than
>> having one table per experiment.
>>
> it looks to me that the resulting code should be more compact but more
> difficult to write and maybe too clever for me. I'm writing this code for
> someone who is not completely sure of what he really wants (I mean the data
> that should be stored in the table) and  so the code should be able to
> accept some change in the definition of the experiments without breaking
> the old data.
>
>> databases aren't flat files, use them as designed and they'll perform
>> very well.
>>
>
> I agree with that. My main worry is that I'm not so familiar with
> databases and I hope I can estimate if the code will perform well in real
> condition when I'll do some limited tests.
>
> thanks  for the information and I'll give it a try
>
> sincerely
>
> 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/54AEEE0B.3020408%40lpn.cnrs.fr.
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Add another link missing in Chrome

2014-12-12 Thread Timothy Good
Russ,

Bingo!  I cleared Chrome's images & files "From the beginning of time" 
 (now there is a weird idea) and it was fine.

Much appreciated.

Tim

On Saturday, December 6, 2014 9:15:43 PM UTC-5, Russell Keith-Magee wrote:
>
> Hi Timothy,
>
> No two browsers will ever render things *identically*, but it should 
> certainly be functionally equivalent, and at least bear a striking 
> resemblance to each other. There certainly shouldn't be a missing button or 
> anything like that.
>
> My immediate reaction is that you've probably got something cached in your 
> browser - Chrome caches very aggressively, and sometimes needs to be 
> politely kicked to get it to refresh some resources. However, if you can 
> reproduce this problem if you start from scratch, it's definitely worth a 
> bug report.
>
> Yours,
> Russ Magee %-)
>
> On Sat, Dec 6, 2014 at 8:51 PM, Timothy Good  > wrote:
>
>> Here is the heart of my question:  Is basic Django code (like in the poll 
>> tutoiral) supposed to render the same in different browsers? If the answer 
>> is 'Yes' this looks like a bug.  Thoughts?  
>>
>>
>> On Friday, December 5, 2014 11:19:37 AM UTC-5, Timothy Good wrote:
>>>
>>> Django Users,
>>>
>>> I am working through polls tutorial part 2 that enhances the admin 
>>> page.  Note that I did search for a solution in the recommended places but 
>>> while I saw similar complaints, none seemed to match exactly.
>>>  
>>> In poll tutorial 2 it says "At the end of the three current slots you 
>>> will find an “Add another Choice” link."  But this is not the case in 
>>> Chrome.
>>>
>>> If I view source in Chrome I see this function but the addText does not 
>>> appear.  (I am on the latest Chrome: Version 39.0.2171.71 (64-bit)) 
>>>  This is in the source:
>>>
>>> 
>>>
>>> (function($) {
>>> $("#choice_set-group .tabular.inline-related tbody tr").tabularFormset({
>>> prefix: "choice_set",
>>> adminStaticPrefix: '/static/admin/',
>>> addText: "Add another Choice",
>>> deleteText: "Remove"
>>> });
>>> })(django.jQuery);
>>> 
>>>
>>>
>>>
>>>
>>> For the heck of it I gave it a try in Safari and it rendered just fine.
>>>
>>> Here is my code in admin.py:
>>>
>>> from django.contrib import admin
>>> from polls.models import Question, Choice
>>>
>>> class ChoiceInline(admin.TabularInline):
>>> model = Choice
>>> extra = 3
>>>
>>> class QuestionAdmin(admin.ModelAdmin):
>>> fieldsets = [
>>> (None,   {'fields': ['question_text']}),
>>> ('Date information', {'fields': ['pub_date'], 'classes': 
>>> ['collapse']}),
>>> ]
>>> inlines = [ChoiceInline]
>>>
>>> admin.site.register(Question, QuestionAdmin)
>>>
>>> Any thoughts or is this a known issue?
>>>
>>> Thanks,
>>> Tim
>>>
>>>
>>>
>>>
>>>
>>>
>>>  
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e00baaef-353a-4226-9a43-e574d8c07622%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e00baaef-353a-4226-9a43-e574d8c07622%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: Add another link missing in Chrome

2014-12-06 Thread Timothy Good
Here is the heart of my question:  Is basic Django code (like in the poll 
tutoiral) supposed to render the same in different browsers? If the answer 
is 'Yes' this looks like a bug.  Thoughts?  

On Friday, December 5, 2014 11:19:37 AM UTC-5, Timothy Good wrote:
>
> Django Users,
>
> I am working through polls tutorial part 2 that enhances the admin page. 
>  Note that I did search for a solution in the recommended places but while 
> I saw similar complaints, none seemed to match exactly.
>  
> In poll tutorial 2 it says "At the end of the three current slots you 
> will find an “Add another Choice” link."  But this is not the case in 
> Chrome.
>
> If I view source in Chrome I see this function but the addText does not 
> appear.  (I am on the latest Chrome: Version 39.0.2171.71 (64-bit))  This 
> is in the source:
>
> 
>
> (function($) {
> $("#choice_set-group .tabular.inline-related tbody tr").tabularFormset({
> prefix: "choice_set",
> adminStaticPrefix: '/static/admin/',
> addText: "Add another Choice",
> deleteText: "Remove"
> });
> })(django.jQuery);
> 
>
>
>
>
> For the heck of it I gave it a try in Safari and it rendered just fine.
>
> Here is my code in admin.py:
>
> from django.contrib import admin
> from polls.models import Question, Choice
>
> class ChoiceInline(admin.TabularInline):
> model = Choice
> extra = 3
>
> class QuestionAdmin(admin.ModelAdmin):
> fieldsets = [
> (None,   {'fields': ['question_text']}),
> ('Date information', {'fields': ['pub_date'], 'classes': 
> ['collapse']}),
> ]
> inlines = [ChoiceInline]
>
> admin.site.register(Question, QuestionAdmin)
>
> Any thoughts or is this a known issue?
>
> Thanks,
> Tim
>
>
>
>
>
>
>  
>

-- 
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/e00baaef-353a-4226-9a43-e574d8c07622%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Add another link missing in Chrome

2014-12-05 Thread Timothy Good
Django Users,

I am working through polls tutorial part 2 that enhances the admin page. 
 Note that I did search for a solution in the recommended places but while 
I saw similar complaints, none seemed to match exactly.
 
In poll tutorial 2 it says "At the end of the three current slots you will 
find an “Add another Choice” link."  But this is not the case in Chrome.

If I view source in Chrome I see this function but the addText does not 
appear.  (I am on the latest Chrome: Version 39.0.2171.71 (64-bit))  This 
is in the source:



(function($) {
$("#choice_set-group .tabular.inline-related tbody tr").tabularFormset({
prefix: "choice_set",
adminStaticPrefix: '/static/admin/',
addText: "Add another Choice",
deleteText: "Remove"
});
})(django.jQuery);





For the heck of it I gave it a try in Safari and it rendered just fine.

Here is my code in admin.py:

from django.contrib import admin
from polls.models import Question, Choice

class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3

class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'], 'classes': 
['collapse']}),
]
inlines = [ChoiceInline]

admin.site.register(Question, QuestionAdmin)

Any thoughts or is this a known issue?

Thanks,
Tim






 

-- 
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/6a88fb07-785e-48b8-85df-3b4ed4b14088%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple levels of user in django application

2014-11-29 Thread Timothy W. Cook
You may need to re-think your model design or add a model that aggregates
the others and use it to link to the group model?  There are many options
but only you know the best one.

On Sat, Nov 29, 2014 at 9:33 AM, Anju SB  wrote:

> But the user's details are in different models , Groups may have different
> fields
>
>
>
> On Saturday, 29 November 2014 16:49:35 UTC+5:30, Timothy W. Cook wrote:
>>
>>
>>
>> On Sat, Nov 29, 2014 at 6:49 AM, Anju SB  wrote:
>>
>>> Actually my application needs to store different information about  each
>>> group of users and needs to map these data with the auth_user table.
>>>
>>>
>> ​Yes.  You can create a model for that information and then use the group
>> as a key.  ​
>> ​There are similar examples you​ find with a search engine.  The mailing
>> list and stackoverflow are good places to look.
>>
>>
>>
>>
>>
>>>
>>> On Saturday, 29 November 2014 13:34:49 UTC+5:30, Timothy W. Cook wrote:
>>>>
>>>>
>>>>
>>>> On Sat, Nov 29, 2014 at 3:51 AM, Anju SB  wrote:
>>>>
>>>>> Thank you Scot Hacker.
>>>>>  But my application needs more than one user from the same group.
>>>>>
>>>>>
>>>> ​You can have multiple users in a group. That is kind of the definition
>>>> of a group.  :-)
>>>>
>>>> See here: https://docs.djangoproject.com/en/1.7/topics/auth/default/
>>>>
>>>> HTH,
>>>> Tim
>>>> ​
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Friday, 28 November 2014 23:24:34 UTC+5:30, Scot Hacker wrote:
>>>>>>
>>>>>>
>>>>>> On Friday, November 28, 2014 3:16:41 AM UTC-8, Anju SB wrote:
>>>>>>>
>>>>>>> Dear Friends,
>>>>>>>
>>>>>>> I want to develop a django based GIS web application.  In my
>>>>>>> application there are different levels of users namely station level 
>>>>>>> user,
>>>>>>> circle level user etc.  Each user details are provided in different 
>>>>>>> table,
>>>>>>>  How can I map/ relate the user with these tables.  Pleas help me to 
>>>>>>> solve
>>>>>>> this issue.
>>>>>>>
>>>>>>
>>>>>> I think of situations like this as having two prongs:
>>>>>>
>>>>>> 1) Various groups have various permission levels in portions of the
>>>>>> project
>>>>>> 2) Group members may have additional data/fields associated with
>>>>>> their profiles.
>>>>>>
>>>>>> For #1, use Django's Groups system to assign group memberships and
>>>>>>  permissions as needed. You can start using those permissions throughout
>>>>>> your project immediately.
>>>>>>
>>>>>> For #2, you can create additional profile sub-types, keyed to a base
>>>>>> profile. e.g. maybe everyone gets a UserProfile, while instructors also 
>>>>>> get
>>>>>> an InstructorProfile that's FK'd to UserProfile. You can use post-save
>>>>>> signals or other mechanisms to make sure that everyone has the right
>>>>>> additional profile fields. Now let's say a user is looking at their 
>>>>>> profile
>>>>>> editor - you could say "If user in group Instructors, also let them edit
>>>>>> their associated InstructorProfile."
>>>>>>
>>>>>> There are many ways to skin this cat...
>>>>>>
>>>>>> ./s
>>>>>>
>>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>> Visit this group at http://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>> msgid/django-use

Re: Multiple levels of user in django application

2014-11-29 Thread Timothy W. Cook
On Sat, Nov 29, 2014 at 6:49 AM, Anju SB  wrote:

> Actually my application needs to store different information about  each
> group of users and needs to map these data with the auth_user table.
>
>
​Yes.  You can create a model for that information and then use the group
as a key.  ​
​There are similar examples you​ find with a search engine.  The mailing
list and stackoverflow are good places to look.





>
> On Saturday, 29 November 2014 13:34:49 UTC+5:30, Timothy W. Cook wrote:
>>
>>
>>
>> On Sat, Nov 29, 2014 at 3:51 AM, Anju SB  wrote:
>>
>>> Thank you Scot Hacker.
>>>  But my application needs more than one user from the same group.
>>>
>>>
>> ​You can have multiple users in a group. That is kind of the definition
>> of a group.  :-)
>>
>> See here: https://docs.djangoproject.com/en/1.7/topics/auth/default/
>>
>> HTH,
>> Tim
>> ​
>>
>>
>>
>>
>>
>>
>>>
>>>
>>>
>>>
>>> On Friday, 28 November 2014 23:24:34 UTC+5:30, Scot Hacker wrote:
>>>>
>>>>
>>>> On Friday, November 28, 2014 3:16:41 AM UTC-8, Anju SB wrote:
>>>>>
>>>>> Dear Friends,
>>>>>
>>>>> I want to develop a django based GIS web application.  In my
>>>>> application there are different levels of users namely station level user,
>>>>> circle level user etc.  Each user details are provided in different table,
>>>>>  How can I map/ relate the user with these tables.  Pleas help me to solve
>>>>> this issue.
>>>>>
>>>>
>>>> I think of situations like this as having two prongs:
>>>>
>>>> 1) Various groups have various permission levels in portions of the
>>>> project
>>>> 2) Group members may have additional data/fields associated with their
>>>> profiles.
>>>>
>>>> For #1, use Django's Groups system to assign group memberships and
>>>>  permissions as needed. You can start using those permissions throughout
>>>> your project immediately.
>>>>
>>>> For #2, you can create additional profile sub-types, keyed to a base
>>>> profile. e.g. maybe everyone gets a UserProfile, while instructors also get
>>>> an InstructorProfile that's FK'd to UserProfile. You can use post-save
>>>> signals or other mechanisms to make sure that everyone has the right
>>>> additional profile fields. Now let's say a user is looking at their profile
>>>> editor - you could say "If user in group Instructors, also let them edit
>>>> their associated InstructorProfile."
>>>>
>>>> There are many ways to skin this cat...
>>>>
>>>> ./s
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/5750f591-276b-49da-bfc5-61c4d0a51f07%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5750f591-276b-49da-bfc5-61c4d0a51f07%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> 
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>   --
> 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/a5cb2cdb-3064-48ff-bebd-88ac90bce602%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a5cb2cdb-3064-48ff-bebd-88ac90bce602%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3XscTpY6hK4%2BK7MAuijt5H2rBbtssMhYMKQjcka%3D7C4Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple levels of user in django application

2014-11-29 Thread Timothy W. Cook
On Sat, Nov 29, 2014 at 3:51 AM, Anju SB  wrote:

> Thank you Scot Hacker.
>  But my application needs more than one user from the same group.
>
>
​You can have multiple users in a group. That is kind of the definition of
a group.  :-)

See here: https://docs.djangoproject.com/en/1.7/topics/auth/default/

HTH,
Tim
​






>
>
>
>
> On Friday, 28 November 2014 23:24:34 UTC+5:30, Scot Hacker wrote:
>>
>>
>> On Friday, November 28, 2014 3:16:41 AM UTC-8, Anju SB wrote:
>>>
>>> Dear Friends,
>>>
>>> I want to develop a django based GIS web application.  In my application
>>> there are different levels of users namely station level user, circle level
>>> user etc.  Each user details are provided in different table,  How can I
>>> map/ relate the user with these tables.  Pleas help me to solve this issue.
>>>
>>>
>>
>> I think of situations like this as having two prongs:
>>
>> 1) Various groups have various permission levels in portions of the
>> project
>> 2) Group members may have additional data/fields associated with their
>> profiles.
>>
>> For #1, use Django's Groups system to assign group memberships and
>>  permissions as needed. You can start using those permissions throughout
>> your project immediately.
>>
>> For #2, you can create additional profile sub-types, keyed to a base
>> profile. e.g. maybe everyone gets a UserProfile, while instructors also get
>> an InstructorProfile that's FK'd to UserProfile. You can use post-save
>> signals or other mechanisms to make sure that everyone has the right
>> additional profile fields. Now let's say a user is looking at their profile
>> editor - you could say "If user in group Instructors, also let them edit
>> their associated InstructorProfile."
>>
>> There are many ways to skin this cat...
>>
>> ./s
>>
>>  --
> 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/5750f591-276b-49da-bfc5-61c4d0a51f07%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5750f591-276b-49da-bfc5-61c4d0a51f07%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Does Django offers a way to generate data grid from database table like web2py

2014-11-28 Thread Timothy W. Cook
The Django 'admin' section provides this functionality.


On Fri, Nov 28, 2014 at 2:55 AM, Sarbjit singh 
wrote:

> What web2py GRID does is, that it takes the SQL table/query as argument,
> and return the records satisfying the query.
>
> Records which are returned are seen in bootstrap enabled table with
> features having pagintation, sorting, search, ability to edit/delete/view
> individual record, add new record etc.
>
> (See for link - web2py grid snapshot as well
> <http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid-and-SQLFORM-smartgrid>
> )
>
> *What I want?*
>
> I just wanted to have the end result similar to as of web2py grid where
> records (satisfying any query) can be seen inside a tabular form with the
> ability to search, sort, edit/delete individual record etc.
>
> Since, I am new to Django, I am not sure if Django provides such a thing
> out of box or any third party app provides this capability.
>
> If you just click on web2py link above, snapshot of web2py grid will give
> you a clear idea.
>
> -Sarbjit
>
>  --
> 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/719e8cc9-4c8e-4aaa-900b-a030c73eb1e7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/719e8cc9-4c8e-4aaa-900b-a030c73eb1e7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3XNJJrbLU_PLiEnOPb1%3D-7NgU3ktAWnO3V_7hU_0RcqDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading Django (to 1.7)

2014-11-26 Thread Timothy W. Cook
Excellent resource.
Thanks Andrew.



On Tue, Nov 25, 2014 at 10:16 PM, Andrew Pinkham 
wrote:

> Hi,
> Upgrading Django (to 1.7) Part IV: Upgrade Strategies is now available!
>
> For the article:
>  afrg.co/updj17/a4/
>
> For all of the material:
>  afrg.co/updj17/
>
> I've also provided a checklist of upgrade steps, as well as a list of all
> the links used throughout the series:
>  afrg.co/updj17/cl/
>  afrg.co/updj17/l/
>
> Any feedback appreciated. I hope you find the material helpful.
>
> Andrew
>
> --
> 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/73E604D5-964A-48CE-A0ED-F0856DE5AD2B%40andrewsforge.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VZva0A4mMOka4%2BOOCMPVD0anXS8O%3DwGfBeztVLYxPqZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
Progress:  I moved the Polymer code tree to my static directory and
replaced the URL with

designer

This at least lets me load the designer.

Now on to see if I can build ajax calls to class based views or maybe there
is another way?



Cheers,
Tim


On Wed, Nov 19, 2014 at 1:59 PM, Timothy W. Cook  wrote:

> Maybe I bit off too much to start.  IT looks like this may be a better
> place to start.
>
> http://themikelewis.com/2014/10/01/django-and-polymer-the-basics-and-vulcanizing/
>
>
> ... and not running the Django development server.
>
>
> On Wed, Nov 19, 2014 at 12:18 PM, Timothy W. Cook  wrote:
>
>>
>> On Wed, Nov 19, 2014 at 12:10 PM, Avraham Serour 
>> wrote:
>>
>>> the line you posted is not a call to any template, it translates to a
>>> url address given the view name.
>>>
>>> the top line means that the staticfiles module is loaded, you need that
>>> in order to use it in the template below, my question is if you actually
>>> use it, how do you point to the js file for example?
>>>
>>>
>> ​Ah, okay.  The js file is ​called in the header of designer.html
>> 
>>
>> then the designer-element.html is imported:
>> > href="elements/designer-element/designer-element.html">
>>
>> The code is the same as
>> https://github.com/twcook/TdV-app-designer/blob/tdv/index.html
>>
>> except the file is named designer.html vs. index.html
>>
>> Thanks,
>> Tim
>>
>>
>>
>>
>>
>>
>>
>>
>>> On Wed, Nov 19, 2014 at 3:02 PM, Timothy W. Cook  wrote:
>>>
>>>> At the top of the both the main file where designer is called from and
>>>> at the top of designer.html I have:
>>>> {% load staticfiles i18n %}
>>>>
>>>> The call to the designer template is in a list with other calls that
>>>> work fine:
>>>>
>>>> designer
>>>>
>>>> Thanks,
>>>> Tim
>>>>
>>>>
>>>> On Wed, Nov 19, 2014 at 10:54 AM, Avraham Serour 
>>>> wrote:
>>>>
>>>>> looks like the html rendered is making the recursive requests, are you
>>>>> using {% static %} and {% url 'designer' %} ?
>>>>>
>>>>> On Wed, Nov 19, 2014 at 1:53 PM, Timothy W. Cook 
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> I have a Django app that I want to include a UI similar to the
>>>>>> Polymer designer https://www.polymer-project.org/tools/designer/
>>>>>> Source code here:
>>>>>> https://github.com/twcook/TdV-app-designer/tree/tdv  plus the
>>>>>> components installed via bower.
>>>>>>
>>>>>>
>>>>>> I have built this designer as a standalone app and it works great
>>>>>> using  python -m SimpleHTTPServer
>>>>>>
>>>>>> I have the code included in the Django app templates directory,
>>>>>> renamed index.html to designer.html
>>>>>>
>>>>>> I have a url entry:
>>>>>>
>>>>>> url(r'^designer/', (DesignerView.as_view()), name='designer')
>>>>>>
>>>>>> I have a view:
>>>>>>
>>>>>> class DesignerView(TemplateView):
>>>>>> template_name = 'TdV-app-designer/designer.html'
>>>>>>
>>>>>>
>>>>>> and I have tried using the {% verbatim %} {% endverbatim %} tags to
>>>>>> wrap the code (the entire file, just the body, just the >>>>> id="designer"> tags, etc.) all to no success.
>>>>>>
>>>>>> What happens is that the server begins recursively calling the custom
>>>>>> element.
>>>>>>
>>>>>> ​So I get:
>>>>>>
>>>>>> [19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
>>>>>> [19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
>>>>>> [19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
>>>>>> HTTP/1.1" 200 10196
>>>>>> [19/Nov/2014 09:46:44] "GET
>>>>>> /designer/elements/designer-element/designer-element.html HTTP/1.1" 200
>>>>>> 10193
>>>>>> [19/Nov/2014 09:46:44] "GET
>>>>>> /designer/element

Re: Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
Maybe I bit off too much to start.  IT looks like this may be a better
place to start.
http://themikelewis.com/2014/10/01/django-and-polymer-the-basics-and-vulcanizing/


... and not running the Django development server.


On Wed, Nov 19, 2014 at 12:18 PM, Timothy W. Cook  wrote:

>
> On Wed, Nov 19, 2014 at 12:10 PM, Avraham Serour 
> wrote:
>
>> the line you posted is not a call to any template, it translates to a url
>> address given the view name.
>>
>> the top line means that the staticfiles module is loaded, you need that
>> in order to use it in the template below, my question is if you actually
>> use it, how do you point to the js file for example?
>>
>>
> ​Ah, okay.  The js file is ​called in the header of designer.html
> 
>
> then the designer-element.html is imported:
> 
>
> The code is the same as
> https://github.com/twcook/TdV-app-designer/blob/tdv/index.html
>
> except the file is named designer.html vs. index.html
>
> Thanks,
> Tim
>
>
>
>
>
>
>
>
>> On Wed, Nov 19, 2014 at 3:02 PM, Timothy W. Cook  wrote:
>>
>>> At the top of the both the main file where designer is called from and
>>> at the top of designer.html I have:
>>> {% load staticfiles i18n %}
>>>
>>> The call to the designer template is in a list with other calls that
>>> work fine:
>>>
>>> designer
>>>
>>> Thanks,
>>> Tim
>>>
>>>
>>> On Wed, Nov 19, 2014 at 10:54 AM, Avraham Serour 
>>> wrote:
>>>
>>>> looks like the html rendered is making the recursive requests, are you
>>>> using {% static %} and {% url 'designer' %} ?
>>>>
>>>> On Wed, Nov 19, 2014 at 1:53 PM, Timothy W. Cook  wrote:
>>>>
>>>>>
>>>>> I have a Django app that I want to include a UI similar to the Polymer
>>>>> designer https://www.polymer-project.org/tools/designer/
>>>>> Source code here:  https://github.com/twcook/TdV-app-designer/tree/tdv
>>>>>  plus the components installed via bower.
>>>>>
>>>>>
>>>>> I have built this designer as a standalone app and it works great
>>>>> using  python -m SimpleHTTPServer
>>>>>
>>>>> I have the code included in the Django app templates directory,
>>>>> renamed index.html to designer.html
>>>>>
>>>>> I have a url entry:
>>>>>
>>>>> url(r'^designer/', (DesignerView.as_view()), name='designer')
>>>>>
>>>>> I have a view:
>>>>>
>>>>> class DesignerView(TemplateView):
>>>>> template_name = 'TdV-app-designer/designer.html'
>>>>>
>>>>>
>>>>> and I have tried using the {% verbatim %} {% endverbatim %} tags to
>>>>> wrap the code (the entire file, just the body, just the >>>> id="designer"> tags, etc.) all to no success.
>>>>>
>>>>> What happens is that the server begins recursively calling the custom
>>>>> element.
>>>>>
>>>>> ​So I get:
>>>>>
>>>>> [19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
>>>>> [19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
>>>>> [19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
>>>>> HTTP/1.1" 200 10196
>>>>> [19/Nov/2014 09:46:44] "GET
>>>>> /designer/elements/designer-element/designer-element.html HTTP/1.1" 200
>>>>> 10193
>>>>> [19/Nov/2014 09:46:44] "GET
>>>>> /designer/elements/designer-element/components/platform/platform.js
>>>>> HTTP/1.1" 200 10193
>>>>> [19/Nov/2014 09:46:44] "GET
>>>>> /designer/elements/designer-element/elements/designer-element/designer-element.html
>>>>> HTTP/1.1" 200 10193
>>>>> [19/Nov/2014 09:46:44] "GET
>>>>> /designer/elements/designer-element/elements/designer-element/components/platform/platform.js
>>>>> HTTP/1.1" 200 10193
>>>>> [19/Nov/2014 09:46:44] "GET
>>>>> /designer/elements/designer-element/elements/designer-element/elements/designer-element/designer-element.html
>>>>> HTTP/1.1" 200 10194
>>>>>
>>>>> ...
>>>>>
>>>>> it co

Re: Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
On Wed, Nov 19, 2014 at 12:10 PM, Avraham Serour  wrote:

> the line you posted is not a call to any template, it translates to a url
> address given the view name.
>
> the top line means that the staticfiles module is loaded, you need that in
> order to use it in the template below, my question is if you actually use
> it, how do you point to the js file for example?
>
>
​Ah, okay.  The js file is ​called in the header of designer.html


then the designer-element.html is imported:


The code is the same as
https://github.com/twcook/TdV-app-designer/blob/tdv/index.html

except the file is named designer.html vs. index.html

Thanks,
Tim








> On Wed, Nov 19, 2014 at 3:02 PM, Timothy W. Cook  wrote:
>
>> At the top of the both the main file where designer is called from and at
>> the top of designer.html I have:
>> {% load staticfiles i18n %}
>>
>> The call to the designer template is in a list with other calls that work
>> fine:
>>
>> designer
>>
>> Thanks,
>> Tim
>>
>>
>> On Wed, Nov 19, 2014 at 10:54 AM, Avraham Serour 
>> wrote:
>>
>>> looks like the html rendered is making the recursive requests, are you
>>> using {% static %} and {% url 'designer' %} ?
>>>
>>> On Wed, Nov 19, 2014 at 1:53 PM, Timothy W. Cook  wrote:
>>>
>>>>
>>>> I have a Django app that I want to include a UI similar to the Polymer
>>>> designer https://www.polymer-project.org/tools/designer/
>>>> Source code here:  https://github.com/twcook/TdV-app-designer/tree/tdv
>>>>  plus the components installed via bower.
>>>>
>>>>
>>>> I have built this designer as a standalone app and it works great
>>>> using  python -m SimpleHTTPServer
>>>>
>>>> I have the code included in the Django app templates directory, renamed
>>>> index.html to designer.html
>>>>
>>>> I have a url entry:
>>>>
>>>> url(r'^designer/', (DesignerView.as_view()), name='designer')
>>>>
>>>> I have a view:
>>>>
>>>> class DesignerView(TemplateView):
>>>> template_name = 'TdV-app-designer/designer.html'
>>>>
>>>>
>>>> and I have tried using the {% verbatim %} {% endverbatim %} tags to
>>>> wrap the code (the entire file, just the body, just the >>> id="designer"> tags, etc.) all to no success.
>>>>
>>>> What happens is that the server begins recursively calling the custom
>>>> element.
>>>>
>>>> ​So I get:
>>>>
>>>> [19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
>>>> [19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
>>>> [19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
>>>> HTTP/1.1" 200 10196
>>>> [19/Nov/2014 09:46:44] "GET
>>>> /designer/elements/designer-element/designer-element.html HTTP/1.1" 200
>>>> 10193
>>>> [19/Nov/2014 09:46:44] "GET
>>>> /designer/elements/designer-element/components/platform/platform.js
>>>> HTTP/1.1" 200 10193
>>>> [19/Nov/2014 09:46:44] "GET
>>>> /designer/elements/designer-element/elements/designer-element/designer-element.html
>>>> HTTP/1.1" 200 10193
>>>> [19/Nov/2014 09:46:44] "GET
>>>> /designer/elements/designer-element/elements/designer-element/components/platform/platform.js
>>>> HTTP/1.1" 200 10193
>>>> [19/Nov/2014 09:46:44] "GET
>>>> /designer/elements/designer-element/elements/designer-element/elements/designer-element/designer-element.html
>>>> HTTP/1.1" 200 10194
>>>>
>>>> ...
>>>>
>>>> it continues until timeout and probably forever until the server runs
>>>> out of memory.
>>>>
>>>> Anyway, I have no idea what this is telling me.
>>>>
>>>> Any hints as to where the problem is and/or how to fix it?
>>>>
>>>> Thanks,
>>>> Tim
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ​
>>>>
>>>>
>>>>
>>>> 
>>>> Timothy Cook
>>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>>> MLHIM http://www.mlhim.org
>>>>
>>>

Re: Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
What I am looking for is not necessarily an answer, since there is probably
very few people that have tried this.  I am hoping that someone can give me
an idea 'how to troubleshoot' this issue.  How do I break this down into
steps to even see what is happening?  Since platform.js and
designer-element.html are both returning 200 even though the url gets
longer with each recursion; seems strange to me.

Thanks,
Tim


On Wed, Nov 19, 2014 at 11:02 AM, Timothy W. Cook  wrote:

> At the top of the both the main file where designer is called from and at
> the top of designer.html I have:
> {% load staticfiles i18n %}
>
> The call to the designer template is in a list with other calls that work
> fine:
>
> designer
>
> Thanks,
> Tim
>
>
> On Wed, Nov 19, 2014 at 10:54 AM, Avraham Serour 
> wrote:
>
>> looks like the html rendered is making the recursive requests, are you
>> using {% static %} and {% url 'designer' %} ?
>>
>> On Wed, Nov 19, 2014 at 1:53 PM, Timothy W. Cook  wrote:
>>
>>>
>>> I have a Django app that I want to include a UI similar to the Polymer
>>> designer https://www.polymer-project.org/tools/designer/
>>> Source code here:  https://github.com/twcook/TdV-app-designer/tree/tdv
>>>  plus the components installed via bower.
>>>
>>>
>>> I have built this designer as a standalone app and it works great
>>> using  python -m SimpleHTTPServer
>>>
>>> I have the code included in the Django app templates directory, renamed
>>> index.html to designer.html
>>>
>>> I have a url entry:
>>>
>>> url(r'^designer/', (DesignerView.as_view()), name='designer')
>>>
>>> I have a view:
>>>
>>> class DesignerView(TemplateView):
>>> template_name = 'TdV-app-designer/designer.html'
>>>
>>>
>>> and I have tried using the {% verbatim %} {% endverbatim %} tags to wrap
>>> the code (the entire file, just the body, just the >> id="designer"> tags, etc.) all to no success.
>>>
>>> What happens is that the server begins recursively calling the custom
>>> element.
>>>
>>> ​So I get:
>>>
>>> [19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
>>> [19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
>>> [19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
>>> HTTP/1.1" 200 10196
>>> [19/Nov/2014 09:46:44] "GET
>>> /designer/elements/designer-element/designer-element.html HTTP/1.1" 200
>>> 10193
>>> [19/Nov/2014 09:46:44] "GET
>>> /designer/elements/designer-element/components/platform/platform.js
>>> HTTP/1.1" 200 10193
>>> [19/Nov/2014 09:46:44] "GET
>>> /designer/elements/designer-element/elements/designer-element/designer-element.html
>>> HTTP/1.1" 200 10193
>>> [19/Nov/2014 09:46:44] "GET
>>> /designer/elements/designer-element/elements/designer-element/components/platform/platform.js
>>> HTTP/1.1" 200 10193
>>> [19/Nov/2014 09:46:44] "GET
>>> /designer/elements/designer-element/elements/designer-element/elements/designer-element/designer-element.html
>>> HTTP/1.1" 200 10194
>>>
>>> ...
>>>
>>> it continues until timeout and probably forever until the server runs
>>> out of memory.
>>>
>>> Anyway, I have no idea what this is telling me.
>>>
>>> Any hints as to where the problem is and/or how to fix it?
>>>
>>> Thanks,
>>> Tim
>>>
>>>
>>>
>>>
>>>
>>>
>>> ​
>>>
>>>
>>>
>>> 
>>> Timothy Cook
>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>> MLHIM http://www.mlhim.org
>>>
>>>  --
>>> 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/CA%2B%3DOU3XdmJmaPmjpGQe0UMXBwk0mhsawbdk3qynxRHwQhW6rsw%40mail.gm

Re: Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
At the top of the both the main file where designer is called from and at
the top of designer.html I have:
{% load staticfiles i18n %}

The call to the designer template is in a list with other calls that work
fine:

designer

Thanks,
Tim


On Wed, Nov 19, 2014 at 10:54 AM, Avraham Serour  wrote:

> looks like the html rendered is making the recursive requests, are you
> using {% static %} and {% url 'designer' %} ?
>
> On Wed, Nov 19, 2014 at 1:53 PM, Timothy W. Cook  wrote:
>
>>
>> I have a Django app that I want to include a UI similar to the Polymer
>> designer https://www.polymer-project.org/tools/designer/
>> Source code here:  https://github.com/twcook/TdV-app-designer/tree/tdv
>>  plus the components installed via bower.
>>
>>
>> I have built this designer as a standalone app and it works great
>> using  python -m SimpleHTTPServer
>>
>> I have the code included in the Django app templates directory, renamed
>> index.html to designer.html
>>
>> I have a url entry:
>>
>> url(r'^designer/', (DesignerView.as_view()), name='designer')
>>
>> I have a view:
>>
>> class DesignerView(TemplateView):
>> template_name = 'TdV-app-designer/designer.html'
>>
>>
>> and I have tried using the {% verbatim %} {% endverbatim %} tags to wrap
>> the code (the entire file, just the body, just the > id="designer"> tags, etc.) all to no success.
>>
>> What happens is that the server begins recursively calling the custom
>> element.
>>
>> ​So I get:
>>
>> [19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
>> [19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
>> [19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
>> HTTP/1.1" 200 10196
>> [19/Nov/2014 09:46:44] "GET
>> /designer/elements/designer-element/designer-element.html HTTP/1.1" 200
>> 10193
>> [19/Nov/2014 09:46:44] "GET
>> /designer/elements/designer-element/components/platform/platform.js
>> HTTP/1.1" 200 10193
>> [19/Nov/2014 09:46:44] "GET
>> /designer/elements/designer-element/elements/designer-element/designer-element.html
>> HTTP/1.1" 200 10193
>> [19/Nov/2014 09:46:44] "GET
>> /designer/elements/designer-element/elements/designer-element/components/platform/platform.js
>> HTTP/1.1" 200 10193
>> [19/Nov/2014 09:46:44] "GET
>> /designer/elements/designer-element/elements/designer-element/elements/designer-element/designer-element.html
>> HTTP/1.1" 200 10194
>>
>> ...
>>
>> it continues until timeout and probably forever until the server runs out
>> of memory.
>>
>> Anyway, I have no idea what this is telling me.
>>
>> Any hints as to where the problem is and/or how to fix it?
>>
>> Thanks,
>> Tim
>>
>>
>>
>>
>>
>>
>> ​
>>
>>
>>
>> 
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>  --
>> 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/CA%2B%3DOU3XdmJmaPmjpGQe0UMXBwk0mhsawbdk3qynxRHwQhW6rsw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3XdmJmaPmjpGQe0UMXBwk0mhsawbdk3qynxRHwQhW6rsw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWa6tK4oru4vu9ZL-OXsfq74rQiiaETuUE5zV4rCR29Udg7ag%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWa6tK4oru4vu9ZL-OXsfq74rQiiaETuUE5zV4rCR29Udg7ag%40ma

Webcomponents in Django

2014-11-19 Thread Timothy W. Cook
I have a Django app that I want to include a UI similar to the Polymer
designer https://www.polymer-project.org/tools/designer/
Source code here:  https://github.com/twcook/TdV-app-designer/tree/tdv
 plus the components installed via bower.


I have built this designer as a standalone app and it works great
using  python -m SimpleHTTPServer

I have the code included in the Django app templates directory, renamed
index.html to designer.html

I have a url entry:

url(r'^designer/', (DesignerView.as_view()), name='designer')

I have a view:

class DesignerView(TemplateView):
template_name = 'TdV-app-designer/designer.html'


and I have tried using the {% verbatim %} {% endverbatim %} tags to wrap
the code (the entire file, just the body, just the  tags, etc.) all to no success.

What happens is that the server begins recursively calling the custom
element.

​So I get:

[19/Nov/2014 09:46:41] "GET / HTTP/1.1" 200 12867
[19/Nov/2014 09:46:43] "GET /designer/ HTTP/1.1" 200 10193
[19/Nov/2014 09:46:43] "GET /designer/components/platform/platform.js
HTTP/1.1" 200 10196
[19/Nov/2014 09:46:44] "GET
/designer/elements/designer-element/designer-element.html HTTP/1.1" 200
10193
[19/Nov/2014 09:46:44] "GET
/designer/elements/designer-element/components/platform/platform.js
HTTP/1.1" 200 10193
[19/Nov/2014 09:46:44] "GET
/designer/elements/designer-element/elements/designer-element/designer-element.html
HTTP/1.1" 200 10193
[19/Nov/2014 09:46:44] "GET
/designer/elements/designer-element/elements/designer-element/components/platform/platform.js
HTTP/1.1" 200 10193
[19/Nov/2014 09:46:44] "GET
/designer/elements/designer-element/elements/designer-element/elements/designer-element/designer-element.html
HTTP/1.1" 200 10194

...

it continues until timeout and probably forever until the server runs out
of memory.

Anyway, I have no idea what this is telling me.

Any hints as to where the problem is and/or how to fix it?

Thanks,
Tim






​




Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Setting up Apache to be the web server for apache for Django 1.7 and python 3.3

2014-10-03 Thread Timothy W. Cook
Of course http://www.giyf.com/  but unless you have some very compelling
need to use Apache.  This may be a better choice.
http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/

I found it to be much easier to setup and maintain.



On Fri, Oct 3, 2014 at 9:42 AM, robert brook 
wrote:

> Can someone point me to a document on how to perform a setup for Apache.
>
> What modules would it be good to install ( I presume as a site package for
> Python)?
>
> What should the settings.py reflect to accept calls from Apache?
>
> What do I need to configure in the apache config file?
>
> What port should I use?
>
> I assume that once I use Apache I no longer need to run python manage.py
> runserver, because I will no longer
> be using the local server, but now the Apache server?
>
> Any other suggestions would be helpful.
>
> Is mod_wsgi for a medium traffic web site for https  the way to go?
>
> 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/f5cf6b83-7a90-4ffa-84de-c41aef1c68b0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f5cf6b83-7a90-4ffa-84de-c41aef1c68b0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3V_FaqwM0d9D9Z67VUy55j%2Bo70GbD8t_kOTJS%3DEquVvkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering XML using XSLT

2014-09-27 Thread Timothy W. Cook
On Sat, Sep 27, 2014 at 9:02 AM, John  wrote:

>  Do you have a URL conf that matches the /get_xsd/ccd-description.xsl
> <http://192.168.1.9:8080/get_xsd/ccd-description.xsl> stylesheet? You
> have to match and serve that as well.
>


> Taking a step back though. It looks like you are serving static files that
> would be best served from a webserver, perhaps with some symlinks, so that
> the overhead of Django is not required at all.
>
> John
>


​This gave me the hint in a solution. The overhead isn't a big deal in this
use case so using Django is easier and more portable (I think). ​

​I created a URL:  ​url(r'^get_xsd/ccd-description.xsl',
"ccdgen.views.get_xsl")

and the associated view:
def get_xsl(request):

CWD = os.getcwd()
if CWD == '/':# Live site
xslfile = "/home/ccdgen/ccdlib/ccd-description.xsl"
else: # development
xslfile = "ccdlib/ccd-description.xsl"
xsl = open(xslfile,encoding='utf-8')

response = HttpResponse(mimetype="text/xsl")
for line in xsl:
response.write(line)
xsl.close()

    return response


​ ​
​Thanks for the nudge in the right direction. ​







>
>
> On 27/09/14 12:37, Timothy W. Cook wrote:
>
>  Some details I forgot are that this is Django 1.6.4, Python 3.4.1.
> The 404 error is on http://192.168.1.9:8080/get_xsd/ccd-description.xsl
>
> On Sat, Sep 27, 2014 at 8:10 AM, Timothy W. Cook  wrote:
>
>>  I have a view that opens an XML file (it happens to be a schema but
>> that doesn't matter) that specifies a stylesheet.
>> It works as expected when opening the XML file locally.
>>
>>  ​The stylesheet isn't applied when viewing the file via Django and I
>> see in Firebug that I am getting a 404 on the stylesheet. The stylesheet is
>> in the same directory as the XML file.
>>
>>  So how do I setup a view or add this file to my existing view so it is
>> found?
>>
>>  The view:
>> ​def get_ccddetails(request, id):
>>
>>  ccd = CCD.objects.get(pk=id)
>> ccdid= ccd.ct_id
>>
>>  CWD = os.getcwd()
>> if CWD == '/':# Live site
>> frm_dir = "/home/ccdgen/ccdlib/CCD_"+ ccdid
>> else: # development
>> frm_dir = "ccdlib/CCD_"+ ccdid
>>
>>  filename = frm_dir+"/ccd-"+ccdid+".xsd"
>> if os.path.isfile(filename):
>> response = HttpResponse(mimetype="application/xml; charset=utf-8")
>> f = open(filename, encoding="utf-8")
>> for line in f:
>> response.write(line)
>> f.close()
>> else:
>> response = HttpResponseNotFound("XSD: "+filename+" was not
>> found.")
>> return response
>>
>>  ​The URL:
>> ​url(r'^get_xsd/(?P\d+)$', "ccdgen.views.get_ccddetails",
>> name='getxsd'),
>>
>>
>>
>>  ​ Thanks,
>> Tim ​
>>
>>
>>
>>
>>
>>
>>
>> 
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>
>
>
>  --
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>   --
> 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/CA%2B%3DOU3VLaAHC8bv-S9sQfKLY8efgZOrQjnq4LPUKfB3r%3D3e0_g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3VLaAHC8bv-S9sQfKLY8efgZOrQjnq4LPUKfB3r%3D3e0_g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view th

Re: Rendering XML using XSLT

2014-09-27 Thread Timothy W. Cook
Some details I forgot are that this is Django 1.6.4, Python 3.4.1.
The 404 error is on http://192.168.1.9:8080/get_xsd/ccd-description.xsl

On Sat, Sep 27, 2014 at 8:10 AM, Timothy W. Cook  wrote:

> I have a view that opens an XML file (it happens to be a schema but that
> doesn't matter) that specifies a stylesheet.
> It works as expected when opening the XML file locally.
>
> ​The stylesheet isn't applied when viewing the file via Django and I see
> in Firebug that I am getting a 404 on the stylesheet. The stylesheet is in
> the same directory as the XML file.
>
> So how do I setup a view or add this file to my existing view so it is
> found?
>
> The view:
> ​def get_ccddetails(request, id):
>
> ccd = CCD.objects.get(pk=id)
> ccdid= ccd.ct_id
>
> CWD = os.getcwd()
> if CWD == '/':# Live site
> frm_dir = "/home/ccdgen/ccdlib/CCD_"+ ccdid
> else: # development
> frm_dir = "ccdlib/CCD_"+ ccdid
>
> filename = frm_dir+"/ccd-"+ccdid+".xsd"
> if os.path.isfile(filename):
> response = HttpResponse(mimetype="application/xml; charset=utf-8")
> f = open(filename, encoding="utf-8")
> for line in f:
> response.write(line)
> f.close()
> else:
> response = HttpResponseNotFound("XSD: "+filename+" was not
> found.")
>     return response
>
> ​The URL:
> ​url(r'^get_xsd/(?P\d+)$', "ccdgen.views.get_ccddetails",
> name='getxsd'),
>
>
>
> ​Thanks,
> Tim​
>
>
>
>
>
>
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>


-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3VLaAHC8bv-S9sQfKLY8efgZOrQjnq4LPUKfB3r%3D3e0_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Rendering XML using XSLT

2014-09-27 Thread Timothy W. Cook
I have a view that opens an XML file (it happens to be a schema but that
doesn't matter) that specifies a stylesheet.
It works as expected when opening the XML file locally.

​The stylesheet isn't applied when viewing the file via Django and I see in
Firebug that I am getting a 404 on the stylesheet. The stylesheet is in the
same directory as the XML file.

So how do I setup a view or add this file to my existing view so it is
found?

The view:
​def get_ccddetails(request, id):

ccd = CCD.objects.get(pk=id)
ccdid= ccd.ct_id

CWD = os.getcwd()
if CWD == '/':# Live site
frm_dir = "/home/ccdgen/ccdlib/CCD_"+ ccdid
else: # development
frm_dir = "ccdlib/CCD_"+ ccdid

filename = frm_dir+"/ccd-"+ccdid+".xsd"
if os.path.isfile(filename):
response = HttpResponse(mimetype="application/xml; charset=utf-8")
f = open(filename, encoding="utf-8")
for line in f:
response.write(line)
f.close()
else:
response = HttpResponseNotFound("XSD: "+filename+" was not
found.")
return response

​The URL:
​url(r'^get_xsd/(?P\d+)$', "ccdgen.views.get_ccddetails",
name='getxsd'),



​Thanks,
Tim​








Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3WhQmz95Kv9jaYEpcCMXpxiPh4HYh%2Bo%2B33nYE3Gyt_mEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any stable and trusted packages for python XML?

2014-09-19 Thread Timothy W. Cook
XML is more complex than JSON and AFAIK there isn't a generic tool to do
this.  I work with XML all the time with Python/Django and I would only
recommend lxml http://lxml.de/



On Fri, Sep 19, 2014 at 9:39 PM, Chen Xu  wrote:

> Hi Everyone,
> I wonder if there is any good, stable and trusted django or python package
> that can convert dict to  xml, and load xml into dict, just like what the
> json package does.
>
> Thanks
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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/CACac-qbM%3DXx4NX%2BSCsyfdJ8UxdKNLbETFj2FAH8q3czixtxA4A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACac-qbM%3DXx4NX%2BSCsyfdJ8UxdKNLbETFj2FAH8q3czixtxA4A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Admin UI not commiting to DB

2014-07-15 Thread Timothy W. Cook
On Mon, Jul 14, 2014 at 12:44 PM, Tom Evans 
wrote:

>
>
> Have you ruled out that this is simply a mid air collision? IIRC,
> django admin has no mid air collision detection system
>
> Cheers
>
> Tom
>
> Eg if user A loads Item i, user B loads Item i, user A changes
> i.foo='hi' and saves item i, user B sets i.foo='bar', i.wibble='quuz'.
> User A complains that "admin is not saving my data".
>
>
Thanks Tom.  I haven't had a chance to work on this yet.  However, I can
reproduce it on my development machine with just one user.
Even on the production machine we only have 3 - 5 users at a time and they
are assigned different tasks and aren't likely to be editing the same entry.


I guess the obvious place that this would occur if no one else has the
problem is in the get_form.  It really doesn't do much except check a
boolean and determine if some fields should be readonly.

Example:

def get_form(self, request, obj=None, **kwargs):
try:
if obj.published:
self.readonly_fields =
['prj_name','published','lang','schema_code','data_name','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts',]

except (AttributeError, TypeError) as e:
self.readonly_fields = ['published','schema_code','r_code',]

return super(DvBooleanAdmin, self).get_form(request, obj, **kwargs)


The try/except was added at one point to see if I could prevent this issue.
 It didn't make a difference so I'll probably take it out when I go back to
working on it.

I do have some actions defined but I can't see how they could cause this
since it is happening during the standard  edit/save process.


I don't recall if I said before: Django 1.6.5 (as well as earlier versions)
PostgreSQL 9.2 and now 9.3 on Ubuntu 14.04 and previously CentOS 6.5




Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3Vf4HE5DUpPnCk1XO%3D%3DP6-%3DJh9T9v2gUT4jjK5miXmSZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin UI not commiting to DB

2014-07-12 Thread Timothy W. Cook
Thanks for the reply Derek.  This post was just a stab to see if anyone had
seen this before and I just missed the post.

I guess it is time to roll up my sleeves and take a formal approach at
debugging.  This one of VERY few, non-open source apps I work on.
 Otherwise I would just point to the repository.

When (if) I find the issue I will post a solution here.

Cheers,
Tim



On Sat, Jul 12, 2014 at 1:21 PM, Derek  wrote:

> Tim
>
> Hard to tell without code; but what happens when you test without the form
> override?  Also, unless you can reproduce the errors they get, then you
> will struggle to debug.  Have you tried adding in log statements at key
> points to try & see where things go haywire?
>
>
> On Saturday, 12 July 2014 10:52:37 UTC+2, Timothy W. Cook wrote:
>>
>> Django 1.65, PostgreSQL.
>>
>> Several users of the admin UI in my app have noted that clicking Save or
>> Save and Continue buttons does not always actually save changes to the
>> database.
>>
>> Has anyone else seen this?  I do override get_form in admin.py so that I
>> can set some fields as readonly based on a boolean flag.  Otherwise my
>> admin.py is pretty generic.
>>
>> Any hint as to where to look for this problem or the best approach to
>> troubleshoot it?
>>
>> --Tim
>>
>> --
>>
>> 
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>>
>>   --
> 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/f22690f1-cd8d-48f0-928d-7fe879efa57f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f22690f1-cd8d-48f0-928d-7fe879efa57f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Admin UI not commiting to DB

2014-07-12 Thread Timothy W. Cook
Django 1.65, PostgreSQL.

Several users of the admin UI in my app have noted that clicking Save or
Save and Continue buttons does not always actually save changes to the
database.

Has anyone else seen this?  I do override get_form in admin.py so that I
can set some fields as readonly based on a boolean flag.  Otherwise my
admin.py is pretty generic.

Any hint as to where to look for this problem or the best approach to
troubleshoot it?

--Tim

-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Python 3 Usage

2014-07-07 Thread Timothy W. Cook
I've been using Python 3 with Django for about 8 months.  No real problems.
 Early on I had to patch a couple of add-ons.



On Mon, Jul 7, 2014 at 9:10 PM, Richard Eng 
wrote:

> I was wondering how many Django users have switched to Python 3. Are the
> majority of users still on Python 2? I'm looking for rough
> proportion/percentage.
>
> I also read that Django and Python 3 have some problems or issues. Is
> there any truth to this?
>
> 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/d2ac4e23-471a-4c11-a16d-54a11b7bef33%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d2ac4e23-471a-4c11-a16d-54a11b7bef33%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
try this get_form:

def get_form(self, request, obj=None, **kwargs):
if obj.readiness:
self.exclude = ("readinessDescription", )
return super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)


I have never used 'exclude' but it looks like yours should work.


On Fri, May 30, 2014 at 9:18 AM, Hilde Rafaelsen 
wrote:

> Thanx,
>
> I now changed my if test to just if obj.readines but then I get the error
> message 'NoneType' object has no attribute 'readiness'
>
>
> I have tried with several fields from my model, but I always get this
> error. I guess it must be something essential I am doing wrong here, since
> my obj seems to be none always...
>
> I have get_form inside my modelAdmin class.
>
>
> On Friday, May 30, 2014 2:06:59 PM UTC+2, Timothy W. Cook wrote:
>
>> What do you mean by tri-state?
>>
>> You are using a field that allows three states: TRUE, FALSE and NULL.
>>
>> If I understand the model, readiness would either be TRUE or FALSE.  But
>> if you do not want to change your field type to:
>> readiness = models.BooleanField("Readiness", blank=True)
>>
>> then try changing:
>> if obj.readiness == True:
>>
>> to:
>>
>> if obj.readiness and obj.readiness == True:
>>
>> or just:
>> if obj.readiness:
>>
>> Will give you the same result.
>>
>> This way if it doesn't exist it will not fail on the  '== TRUE' test.
>>
>>
>>
>> On Fri, May 30, 2014 at 8:49 AM, Hilde Rafaelsen 
>> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> Thanks for the response.
>>>
>>>
>>>
>>> What do you mean by tri-state?
>>>
>>>
>>>
>>> I changed my get_form to this:
>>>
>>> def get_form(self, request, obj=None, **kwargs):
>>>
>>>form = super(RequestForChangeAdmin,
>>> self).get_form(request, obj, **kwargs)
>>>
>>>if obj:
>>>
>>>if obj.readiness == True:
>>>
>>>
>>> self.exclude = ("readinessDescription", )
>>>
>>>form =
>>> super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>>>
>>>return form
>>>
>>>
>>>
>>> No my code run without errors, but nothing happpends though ☺
>>>
>>>
>>>
>>> I have tried to change the readiness filds to yes and no, but the field
>>> readiness descriptions is always displayed. Maybe it is not possibly to get
>>> a fields attribute value from admin before the admin form is posted or
>>> stored in database? Do you know?
>>>
>>>
>>>
>>> Regards,
>>>
>>> Hilde from Norway
>>>
>>> On Friday, May 30, 2014 12:57:19 PM UTC+2, Hilde Rafaelsen wrote:
>>>>
>>>> Hello,
>>>>
>>>> In my django admin page I want to hide some filelds from users if a
>>>> special field value is set. I have tried different solutions to solve my
>>>> problem but is stucked and hope someone can help me,
>>>>
>>>> If you look at my model I want to hide the field readinessDescription
>>>> if readiness value is False (no), when the user log into admin page.
>>>>
>>>> In model.py:
>>>> class RequestForChange (models.Model):
>>>>  rfc = models.AutoField (primary_key=True, help_text="This is the grey
>>>> text")
>>>> heading = models.CharField("Heading", max_length=50)
>>>>readiness = models.NullBooleanField("Readiness", blank=True,
>>>> null=True)
>>>>readinessDescription = models.TextField("Description of
>>>> readiness", max_length=250, blank=True, null=True)
>>>>
>>>>
>>>> I found some hints on the web about using get_form from my
>>>> RequestForChangeAdmin page, but it won't work because i get this error
>>>> 'NoneType' object has no attribute 'readiness'
>>>>
>>>>
>>>> Here is what I have in admin.py:
>>>>
>>>> class RequestForChangeAdmin(admin.ModelAdmin):
>>>> formfield_overrides = {
>>>>  models.ManyToManyField: {'widget': CheckboxSelectMultiple},

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
Maybe it is not possibly to get a fields attribute value from admin before
the admin form is posted or stored in database? Do you know?

Yes, it is possible.  I use this to set which fields are readonly before
defining the fieldsets.  It works great.


def get_form(self, request, obj=None, **kwargs):
try:
if obj.published:
self.readonly_fields =
['prj_name','published','lang','schema_code','description','sem_attr','resource_uri','asserts',

'label','performer_p','function','mode','simple_function','simple_mode',]
except (AttributeError, TypeError) as e:
self.readonly_fields = ['published','schema_code']
return super(ParticipationAdmin, self).get_form(request, obj,
**kwargs)






On Fri, May 30, 2014 at 9:05 AM, Timothy W. Cook  wrote:

> What do you mean by tri-state?
>
> You are using a field that allows three states: TRUE, FALSE and NULL.
>
> If I understand the model, readiness would either be TRUE or FALSE.  But
> if you do not want to change your field type to:
> readiness = models.BooleanField("Readiness", blank=True)
>
> then try changing:
> if obj.readiness == True:
>
> to:
>
> if obj.readiness and obj.readiness == True:
>
> or just:
> if obj.readiness:
>
> Will give you the same result.
>
> This way if it doesn't exist it will not fail on the  '== TRUE' test.
>
>
>
> On Fri, May 30, 2014 at 8:49 AM, Hilde Rafaelsen 
> wrote:
>
>> Hi,
>>
>>
>>
>> Thanks for the response.
>>
>>
>>
>> What do you mean by tri-state?
>>
>>
>>
>> I changed my get_form to this:
>>
>> def get_form(self, request, obj=None, **kwargs):
>>
>>form = super(RequestForChangeAdmin,
>> self).get_form(request, obj, **kwargs)
>>
>>if obj:
>>
>>if obj.readiness == True:
>>
>>
>> self.exclude = ("readinessDescription", )
>>
>>form =
>> super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>>
>>return form
>>
>>
>>
>> No my code run without errors, but nothing happpends though ☺
>>
>>
>>
>> I have tried to change the readiness filds to yes and no, but the field
>> readiness descriptions is always displayed. Maybe it is not possibly to get
>> a fields attribute value from admin before the admin form is posted or
>> stored in database? Do you know?
>>
>>
>>
>> Regards,
>>
>> Hilde from Norway
>>
>> On Friday, May 30, 2014 12:57:19 PM UTC+2, Hilde Rafaelsen wrote:
>>>
>>> Hello,
>>>
>>> In my django admin page I want to hide some filelds from users if a
>>> special field value is set. I have tried different solutions to solve my
>>> problem but is stucked and hope someone can help me,
>>>
>>> If you look at my model I want to hide the field readinessDescription if
>>> readiness value is False (no), when the user log into admin page.
>>>
>>> In model.py:
>>> class RequestForChange (models.Model):
>>>  rfc = models.AutoField (primary_key=True, help_text="This is the grey
>>> text")
>>> heading = models.CharField("Heading", max_length=50)
>>>readiness = models.NullBooleanField("Readiness", blank=True,
>>> null=True)
>>>readinessDescription = models.TextField("Description of
>>> readiness", max_length=250, blank=True, null=True)
>>>
>>>
>>> I found some hints on the web about using get_form from my
>>> RequestForChangeAdmin page, but it won't work because i get this error
>>> 'NoneType' object has no attribute 'readiness'
>>>
>>>
>>> Here is what I have in admin.py:
>>>
>>> class RequestForChangeAdmin(admin.ModelAdmin):
>>> formfield_overrides = {
>>>  models.ManyToManyField: {'widget': CheckboxSelectMultiple},
>>> }
>>> list_display = ('rfc', 'heading', 'enviroment', 'status')
>>>  search_fields = ('changeId',)
>>> list_filter = ('enviroment', 'acceptAT', 'status')
>>>  date_hierarchy = 'criticalDate'
>

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
What do you mean by tri-state?

You are using a field that allows three states: TRUE, FALSE and NULL.

If I understand the model, readiness would either be TRUE or FALSE.  But if
you do not want to change your field type to:
readiness = models.BooleanField("Readiness", blank=True)

then try changing:
if obj.readiness == True:

to:

if obj.readiness and obj.readiness == True:

or just:
if obj.readiness:

Will give you the same result.

This way if it doesn't exist it will not fail on the  '== TRUE' test.



On Fri, May 30, 2014 at 8:49 AM, Hilde Rafaelsen 
wrote:

> Hi,
>
>
>
> Thanks for the response.
>
>
>
> What do you mean by tri-state?
>
>
>
> I changed my get_form to this:
>
> def get_form(self, request, obj=None, **kwargs):
>
>form = super(RequestForChangeAdmin,
> self).get_form(request, obj, **kwargs)
>
>if obj:
>
>if obj.readiness == True:
>
>
> self.exclude = ("readinessDescription", )
>
>form =
> super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>
>return form
>
>
>
> No my code run without errors, but nothing happpends though ☺
>
>
>
> I have tried to change the readiness filds to yes and no, but the field
> readiness descriptions is always displayed. Maybe it is not possibly to get
> a fields attribute value from admin before the admin form is posted or
> stored in database? Do you know?
>
>
>
> Regards,
>
> Hilde from Norway
>
> On Friday, May 30, 2014 12:57:19 PM UTC+2, Hilde Rafaelsen wrote:
>>
>> Hello,
>>
>> In my django admin page I want to hide some filelds from users if a
>> special field value is set. I have tried different solutions to solve my
>> problem but is stucked and hope someone can help me,
>>
>> If you look at my model I want to hide the field readinessDescription if
>> readiness value is False (no), when the user log into admin page.
>>
>> In model.py:
>> class RequestForChange (models.Model):
>> rfc = models.AutoField (primary_key=True, help_text="This is the grey
>> text")
>> heading = models.CharField("Heading", max_length=50)
>>readiness = models.NullBooleanField("Readiness", blank=True,
>> null=True)
>>readinessDescription = models.TextField("Description of
>> readiness", max_length=250, blank=True, null=True)
>>
>>
>> I found some hints on the web about using get_form from my
>> RequestForChangeAdmin page, but it won't work because i get this error
>> 'NoneType' object has no attribute 'readiness'
>>
>>
>> Here is what I have in admin.py:
>>
>> class RequestForChangeAdmin(admin.ModelAdmin):
>> formfield_overrides = {
>> models.ManyToManyField: {'widget': CheckboxSelectMultiple},
>> }
>> list_display = ('rfc', 'heading', 'enviroment', 'status')
>> search_fields = ('changeId',)
>> list_filter = ('enviroment', 'acceptAT', 'status')
>> date_hierarchy = 'criticalDate'
>> inline = [RequestForChangeInline]
>>  def get_form(self, request, obj=None, **kwargs):
>> form = super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>>  print obj
>> if obj.readiness == True:
>> self.exclude = ("readinessDescription", )
>> form = super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>> return form
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5bc768df-3a1c-4b53--2ec19b9c05f0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5bc768df-3a1c-4b53--2ec19b9c05f0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3Xb87s3nHy%2BKPb_UEbVsSsrFd7Z5-OfisDKgN1gD6R6aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
Is 'readiness' really a tri-state flag?

Anyway you may want to test if obj.readiness exists, and is TRUE.

if obj.readiness and obj.readiness == TRUE:


HTH,
Tim



On Fri, May 30, 2014 at 7:57 AM, Hilde Rafaelsen 
wrote:

> Hello,
>
> In my django admin page I want to hide some filelds from users if a
> special field value is set. I have tried different solutions to solve my
> problem but is stucked and hope someone can help me,
>
> If you look at my model I want to hide the field readinessDescription if
> readiness value is False (no), when the user log into admin page.
>
> In model.py:
> class RequestForChange (models.Model):
> rfc = models.AutoField (primary_key=True, help_text="This is the grey
> text")
> heading = models.CharField("Heading", max_length=50)
>readiness = models.NullBooleanField("Readiness", blank=True,
> null=True)
>readinessDescription = models.TextField("Description of readiness",
> max_length=250, blank=True, null=True)
>
>
> I found some hints on the web about using get_form from my
> RequestForChangeAdmin page, but it won't work because i get this error
> 'NoneType' object has no attribute 'readiness'
>
>
> Here is what I have in admin.py:
>
> class RequestForChangeAdmin(admin.ModelAdmin):
> formfield_overrides = {
> models.ManyToManyField: {'widget': CheckboxSelectMultiple},
> }
> list_display = ('rfc', 'heading', 'enviroment', 'status')
> search_fields = ('changeId',)
> list_filter = ('enviroment', 'acceptAT', 'status')
> date_hierarchy = 'criticalDate'
> inline = [RequestForChangeInline]
>  def get_form(self, request, obj=None, **kwargs):
> form = super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
>  print obj
> if obj.readiness == True:
> self.exclude = ("readinessDescription", )
> form = super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs)
> return form
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2c1d74b1-c03c-4c2b-b8db-7d44a06531c4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2c1d74b1-c03c-4c2b-b8db-7d44a06531c4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: website statistics

2014-05-22 Thread Timothy W. Cook
On Wed, May 21, 2014 at 4:46 PM, chansonsyiddish
wrote:

>
> Thanks for the suggestion anyway... other ideas?
>

You can import your logfile data into R and do any analysis you want.




====
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3W3uRnDMXvC-WpOdoJ9RCT3RKp3A%3DqBdX_ZbBXz8-tQZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-13 Thread Timothy W. Cook
I am not sure where your problem is with locale.  Did you ever accomplish
recompiling mod_wsgi for Python 3.3?

This site http://www.ccdgen.com is Django 1.6, Python 3.3 and Apache 2.2 on
CentOS 6.5

I recompiled mod_wsgi as per instructions I found somewhere on the WWW.
 Sorry I do not have the link now.  As I recall, there were several
additional packages I had to track down and install.

The Django code is in a User home subdirectory and the 'apache' user in the
'ccdgen' group.

The relevant sections of httpd.conf are:
Alias /icons/ "/var/www/icons/"


Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all


Alias /static/ "/var/www/ccdgen/static/"


Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all




and

WSGIScriptAlias / /home/ccdgen/CCDGEN2/ccdgen/mlhim/wsgi.py
WSGIPythonPath
/home/ccdgen/CCDGEN2/ccdgen/ccdgen:/home/ccdgen/CCDGEN2/ccdgen:/home/ccdgen/CCDGEN2/lib/python3.3/site-packages

   
 Order allow,deny
 Allow from all
   



Maybe something here will 'stick out' as a solution for you.

HTH,
Tim







On Tue, May 13, 2014 at 6:14 AM, Guillem Liarte <
guillem.lia...@googlemail.com> wrote:

> Has anybody being able to solve this problem with the locale in virtual
> env?
>
> I am stuck with it for the moment.
>
> It is just that Centos 6 + Django 1.7 (python3.x ) is a no-go?
>
> Thanks.
>
> On Wednesday, 7 May 2014 16:33:23 UTC+2, Guillem Liarte wrote:
>>
>> Timothy,
>>
>> Thanks you, but SELinux here does not seem to be the issue. I tried with
>> enforcing/permissive/disabled and the effect is the same.
>>
>> I belive the problem to be in the os path in the seetings:
>>
>> ---
>>
>> import os
>> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>> ...
>> ...
>>
>>
>>
>>
>>
>>
>> --
>>
>> in wsgi.py :
>>
>> 
>>
>> import os, sys
>> sys.path.append('/data/app/guillem-py3-dj17-test/guillem_test/guillem_test')
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "guillem_test.settings")
>>
>>
>> ---
>>
>> python -c "import sys; print(sys.path)"
>> ['', '/data/app/guillem-py3-dj17-test/lib64/python33.zip',
>> '/data/app/guillem-py3-dj17-test/lib64/python3.3',
>> '/data/app/guillem-py3-dj17-test/lib64/python3.3/plat-linux',
>> '/data/app/guillem
>> -py3-dj17-test/lib64/python3.3/lib-dynload', 
>> '/opt/rh/python33/root/usr/lib64/python3.3',
>> '/opt/rh/python33/root/usr/lib/python3.3', '/data/app/guillem-py3-dj17-
>> test/lib/python3.3/site-packa
>> ges']
>>
>>
>>
>>
>> I am reading about the differnces for mod_wsgi from python2.x to
>> python3.x but I fail to find clear documentation about how the wsgi.py and
>> settings.py should look like in python3.
>>
>> On Wednesday, 7 May 2014 00:20:00 UTC+2, Timothy W. Cook wrote:
>>>
>>>
>>> On Tue, May 6, 2014 at 7:01 PM, Guillem Liarte <
>>> guillem...@googlemail.com> wrote:
>>>
>>>>
>>>>
>>>> But I still get the locale encoding problem.  Do you guys have any
>>>> suggestions?
>>>>
>>>> I do not recall the exact error I had with this config (once you
>>> corrected those you mentioned) but eventually I had to set:
>>>
>>> $setenforce 0
>>>
>>> to disable SELinux security.  I am sure that there is a way around this
>>> but I haven't had a need to fix it yet.
>>>
>>> HTH,
>>> Tim
>>>
>>>
>>>
>>> 
>>> Timothy Cook
>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>> MLHIM http://www.mlhim.org
>>>
>>>   --
> 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/f61d9fbc-8922-4ba9-8564-45ae1eccf0f3%40googlegroups.com<https://groups.google.com/d/msgid/django-users/f61d9fbc-8922-4ba9-8564-45ae1eccf0f3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: django on rhel5 with both python2.4 and python2.7 confusion

2014-05-12 Thread Timothy W. Cook
I can't imagine virtualenv being a vulnerability risk.  AFAIK; All it does
is create a set of scripts to isolate the executing Python environment.
http://virtualenv.readthedocs.org/en/latest/virtualenv.html

In fact, I would almost say that it improves your ability to know EXACTLY
what is in your environment irregardless of the rest of the machine.

Frankly, I do not create any Python code outside of a specified virtualenv.
 Web apps or any other scripts or apps.




On Mon, May 12, 2014 at 7:50 AM, David Malcolm  wrote:

> Hi Timothy
>
> thanks for your suggestions. I'm still on the path. I'll put more details
> in my reply to WongoBongo below.
>
> cheers
> Dave
>
> --
> 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/f10d728f-b690-4681-8807-0c66d7ddd8b9%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3Ui-QV2TRKq3PgOxy4pPBgpRzDS_0S5ZK%2BwzpmgJEHjMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on rhel5 with both python2.4 and python2.7 confusion

2014-05-07 Thread Timothy W. Cook
A good place to start is with this thread:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/django-users/_0RTNcYyCSI/24QinBTEnX8J


Be sure to include CentOS in your searches for clues about this setup since
many people use CentOS instead of RHEL.

HTH,
Tim



On Wed, May 7, 2014 at 6:08 AM, David Malcolm  wrote:

> I have been tasked with finishing a build for production that was
> interrupted due to another staff member leaving at short notice. It's
> RedHat Enterprise Linux 5 and there are two versions of python on the box.
> If I type python I get version 2.7. However if I try and use
> django-admin.py I find that it is trying to use python version 2.4. How do
> I specify to Django that I want to use python 2.7? I've seen multiple
> supposed answers on the net but nothing actually seems to answer my
> specific question. I'm fairly experienced on linux but have never had to
> setup django and python before. My Apache, php, phpMyAdmin setup is all
> working properly (after I sorted out some other issues),  but my second
> question is how do I wire up python/django to apache (or httpd as rhel5
> calls it). I've tried using mod_wsgi but have been told I must use
> mod_python. Advice or pointers to relevant urls are much appreciated.
> Thanks Dave, Melbourne
>
> --
> 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/74af440c-b42d-4fcd-abfa-74da94958b73%40googlegroups.com<https://groups.google.com/d/msgid/django-users/74af440c-b42d-4fcd-abfa-74da94958b73%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
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/CA%2B%3DOU3UYTe0r6gqiCQj3%3DcQh6EqMrRzQDk5-R-9cxd9CCQPR0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-06 Thread Timothy W. Cook
On Tue, May 6, 2014 at 7:01 PM, Guillem Liarte <
guillem.lia...@googlemail.com> wrote:

>
>
> But I still get the locale encoding problem.  Do you guys have any
> suggestions?
>
> I do not recall the exact error I had with this config (once you corrected
those you mentioned) but eventually I had to set:

$setenforce 0

to disable SELinux security.  I am sure that there is a way around this but
I haven't had a need to fix it yet.

HTH,
Tim



====
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

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


Re: Analysis of csv data

2014-04-10 Thread Timothy W. Cook
Uh, R  ???

http://cran.r-project.org/doc/manuals/R-intro.html




On Thu, Apr 10, 2014 at 7:43 AM, Saransh Mehta wrote:

> I need to analyze the incoming data from the csv file and present it to
> the user in the best possible way?
> What tools do i need to use for analyzing the csv and drawing graphs etc
> out of the csv?
>
> --
> 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/818ecde6-ab66-48f5-8b2c-8590e9e787be%40googlegroups.com<https://groups.google.com/d/msgid/django-users/818ecde6-ab66-48f5-8b2c-8590e9e787be%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3Uy5SCQmWLGu2LbJ0OsxFL6GFUh3w-B_dtmygkjt%3DV1hA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


"depth" keyword argument has been deprecated. Use related field names instead.

2014-03-12 Thread Timothy W. Cook
I am using django-forms-builder and I am updating it to work with later
versions of Django.
I get the above deprecation warning.  This is the code:


forms.py line 367:
# Get the field entries for the given form and filter by entry_time
# if specified.
model = self.fieldentry_model
field_entries = model.objects.filter(entry__form=self.form
).order_by("-entry__id").select_related(depth=1)




I do not think that the related name is known ahead of time in this.  Can
anyone suggest how to fix this?

For more context, the code is here:
https://github.com/stephenmcd/django-forms-builder/tree/master/forms_builder/forms





-- 
MLHIM VIP Signup: http://goo.gl/22B0U
========
Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

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


Re: Template/Form Errors and DynaTree.js

2014-03-01 Thread Timothy W. Cook
Still not there yet.  There is something I am not understanding about
capturing the response back from the server.   It still opens the template
as an HTML page and not inside the div.  Is it possibly how I am using the
HTTPResponse?  Since I am not modifying it at all.


*View:*
class DvBooleanCreateView(CreateView):
template_name = 'dvboolean_create.html'
success_url = '/dashboard'
model = DvBoolean
fields =
['prj_name','data_name','lang','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts',]
form_class = DvBooleanCreateForm

*Form:*
class DvBooleanCreateForm(forms.ModelForm):
class Meta:
model = DvBoolean
localized_fields = ('__all__',)
fields =
['prj_name','data_name','lang','valid_trues','valid_falses','description','sem_attr','resource_uri','asserts',]

widgets = {
'data_name': TextInput(attrs={'size':90}),
'description': Textarea(attrs={'cols':80,
'rows':5,'wrap':'off'}),
'sem_attr': Textarea(attrs={'cols':15,
'rows':3,'wrap':'off'}),
'resource_uri': Textarea(attrs={'cols':60,
'rows':3,'wrap':'off'}),
'asserts': Textarea(attrs={'cols':80,
'rows':2,'wrap':'off'}),
'valid_trues': Textarea(attrs={'cols':20,
'rows':5,'wrap':'off'}),
'valid_falses': Textarea(attrs={'cols':20,
'rows':5,'wrap':'off'}),

   }



*Template:*


  $(document).ready(function($){
  $('#editbox').perfectScrollbar('update');
  });




$( "pct_form" ).submit(function( event ) {
$.ajax({
type: 'POST',
url: $('pct_form').attr('action'),
dataType: 'html',
data: $form.serialize(),
success: function(data){
$("#editbox").html(data);
},
error: function(xhr, textStatus, errorThrown) {
console.log('AJAX communication failed:', textStatus,
errorThrown);
}
})});


Create a new Boolean
Type.  * = input is required.
  
   {% csrf_token %}

  
  *Project: {{ form.prj_name }}
  *PcT
Name: {{ form.data_name }}
  
  
  *PcT
Language: {{ form.lang }} 
  *Description: {{ form.description }}
  
  
   Semantics
   AttributeURI
   {{ form.sem_attr
}}{{ form.resource_uri
}}
 

  
  Asserts:{{ form.asserts }}
  

  

 
   Boolean Sets
   TruesFalses
   {{ form.valid_trues
}}{{ form.valid_falses
}}
 
  
  

  








On Fri, Feb 28, 2014 at 12:36 PM, Andreas Kuhne
wrote:

> Hi Timothy,
>
> What you could do is create a function that gets the id of the form. It
> can then query the action of the form and the parameters of the form. It
> would look something like this:
>
> function submitForm(form_id) {
> var $form = $("#" + form_id);
>
> $.ajax({
> type: 'POST',
> url: $form.attr('action'),
>  dataType: 'html', data: $form.serialize(), success: function(data){
> $("#old_div_content").html(data); }, error: function(xhr, textStatus,
> errorThrown) { console.log('AJAX communication failed:',
> textStatus, errorThrown); } });
> }
>
> This way it is pretty generic as long as the "old_div_content" div id
> stays the same.
>
> Regards,
>
> Andréas
>
>
>
> Med vänliga hälsningar,
>
> Andréas Kühne
> Software Development Manager
> Suitopia Scandinavia AB
>
>
> 2014-02-28 15:48 GMT+01:00 Timothy W. Cook :
>
>>
>> On Thu, Feb 27, 2014 at 10:18 AM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi again Timothy,
>>>
>>> Actually it's much easier than you think.
>>>
>>
>>
>> Great news!  :-)
>>
>>
>>>
>>> The error you showed is a validation error, is it not?
>>>
>>>
>> Yes.
>>
>>
>> In the example that you gave (below) it seems that I will need an AJAX
>> function for each different form.  Correct?
>>  IOW:
>> There are 25 different forms/views/models that can be selected, one at a
>> time, for create or update in this div.  So, do I understand correctly that
>> I need a function with 

Re: Template/Form Errors and DynaTree.js

2014-02-28 Thread Timothy W. Cook
On Thu, Feb 27, 2014 at 10:18 AM, Andreas Kuhne
wrote:

> Hi again Timothy,
>
> Actually it's much easier than you think.
>


Great news!  :-)


>
> The error you showed is a validation error, is it not?
>
>
Yes.


In the example that you gave (below) it seems that I will need an AJAX
function for each different form.  Correct?
IOW:
There are 25 different forms/views/models that can be selected, one at a
time, for create or update in this div.  So, do I understand correctly that
I need a function with the correct URL and data map for each one of those?
 If so, what is the approach to calling the one the user has selected?  My
urks are named, for example: dvtemporal_create and dvtemporal_update.  Of
course the _update has the record id as well.

There is a lot of information in the Django request so I want to be able to
reuse this with an 'abstract as possible' ajax function.

Thoughts?

--Tim



> What you do is that you submit the form via jquery ajax, something like
> this should work:
>
>   $.ajax({ type: 'POST', url: the_form_url, dataType: 'html', data: {
> email : $('#id_email').val(), name : $('#id_name').val(), phone :
> $('#id_phone').val() }, success: function(data){
> $("#old_div_content").html(data); }, error: function(xhr, textStatus,
> errorThrown) { console.log('AJAX communication failed:',
> textStatus, errorThrown); } });
>
> Now you will have to change the function so that the parameters sent to
> your view are correct (in the data map), the url is correct and the success
> method changes the correct div. You won't have to do any error handling in
> jquery at all, because the validation is on the server. When you replace
> the html in the div that you want to replace, the user will just get the
> validation errors that django creates for you.
>
> You really don't have to change anything in the view that you are using at
> the moment, because it already returns the information that you want in the
> div, all you have to do is get in into the div :-)
>
> Regards,
>
> Andréas
>
>
> 2014-02-27 14:06 GMT+01:00 Timothy W. Cook :
>
>> Hi Andreas,
>>
>> Thanks for the reply.
>>
>>
>> On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi Timothy,
>>>
>>> What you probably have to do is submit the form in a ajax call via
>>> jquery for example. https://api.jquery.com/jQuery.ajax/
>>>
>>> You create a request via the ajax method in jquery and then add a
>>> success and error handler. They only have to update the div you want to
>>> replace: $("#div_id").html(response).
>>>
>>>
>>
>> This certainly seems like a reasonable approach.  The points I am unsure
>> of is:
>>
>> 1)  how do I catch the template error in jQuery?
>>
>> 2) I suppose that I have to (somehow) catch the error in the ModelForm?
>>
>> 3) then send that request to jQuery, somehow?
>>
>> My forms and views are pretty simple at this point.  Here are examples:
>>
>> class DvCodedStringCreateView(CreateView):
>> template_name = 'dvcodedstring_create.html'
>> success_url = '/dashboard'
>> model = DvCodedString
>> form_class = DvCodedStringCreateForm
>> fields =
>> ['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',
>>
>> 'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',
>>
>> 'min_length','max_length','exact_length','enums','enums_annotations','default_value',]
>>
>>
>>
>>
>> class DvCodedStringCreateForm(forms.ModelForm):
>> class Meta:
>> model = DvCodedString
>> widgets = {
>> 'data_name': TextInput(attrs={'size':90}),
>> 'description': Textarea(attrs={'cols':80,
>> 'rows':5,'wrap':'off'}),
>> 'sem_attr': Textarea(attrs={'cols':15,
>> 'rows':3,'wrap':'off'}),
>>     'resource_uri': Textarea(attrs={'cols':60,
>> 'rows':3,'wrap':'off'}),
>> 'asserts': Textarea(attrs={'cols&#x

Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Timothy W. Cook
Thanks Andreas.

I'll poke around with this and see if I can figure it out.

If not;  I'll Be Back!   :-)

Cheers,
Tim



On Thu, Feb 27, 2014 at 10:18 AM, Andreas Kuhne
wrote:

> Hi again Timothy,
>
> Actually it's much easier than you think.
>
> The error you showed is a validation error, is it not?
>
> What you do is that you submit the form via jquery ajax, something like
> this should work:
>
>   $.ajax({ type: 'POST', url: the_form_url, dataType: 'html', data: {
> email : $('#id_email').val(), name : $('#id_name').val(), phone :
> $('#id_phone').val() }, success: function(data){
> $("#old_div_content").html(data); }, error: function(xhr, textStatus,
> errorThrown) { console.log('AJAX communication failed:',
> textStatus, errorThrown); } });
>
> Now you will have to change the function so that the parameters sent to
> your view are correct (in the data map), the url is correct and the success
> method changes the correct div. You won't have to do any error handling in
> jquery at all, because the validation is on the server. When you replace
> the html in the div that you want to replace, the user will just get the
> validation errors that django creates for you.
>
> You really don't have to change anything in the view that you are using at
> the moment, because it already returns the information that you want in the
> div, all you have to do is get in into the div :-)
>
> Regards,
>
> Andréas
>
>
> 2014-02-27 14:06 GMT+01:00 Timothy W. Cook :
>
>> Hi Andreas,
>>
>> Thanks for the reply.
>>
>>
>> On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi Timothy,
>>>
>>> What you probably have to do is submit the form in a ajax call via
>>> jquery for example. https://api.jquery.com/jQuery.ajax/
>>>
>>> You create a request via the ajax method in jquery and then add a
>>> success and error handler. They only have to update the div you want to
>>> replace: $("#div_id").html(response).
>>>
>>>
>>
>> This certainly seems like a reasonable approach.  The points I am unsure
>> of is:
>>
>> 1)  how do I catch the template error in jQuery?
>>
>> 2) I suppose that I have to (somehow) catch the error in the ModelForm?
>>
>> 3) then send that request to jQuery, somehow?
>>
>> My forms and views are pretty simple at this point.  Here are examples:
>>
>> class DvCodedStringCreateView(CreateView):
>> template_name = 'dvcodedstring_create.html'
>> success_url = '/dashboard'
>> model = DvCodedString
>> form_class = DvCodedStringCreateForm
>> fields =
>> ['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',
>>
>> 'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',
>>
>> 'min_length','max_length','exact_length','enums','enums_annotations','default_value',]
>>
>>
>>
>>
>> class DvCodedStringCreateForm(forms.ModelForm):
>> class Meta:
>> model = DvCodedString
>> widgets = {
>> 'data_name': TextInput(attrs={'size':90}),
>> 'description': Textarea(attrs={'cols':80,
>> 'rows':5,'wrap':'off'}),
>> 'sem_attr': Textarea(attrs={'cols':15,
>> 'rows':3,'wrap':'off'}),
>>     'resource_uri': Textarea(attrs={'cols':60,
>> 'rows':3,'wrap':'off'}),
>> 'asserts': Textarea(attrs={'cols':80,
>> 'rows':2,'wrap':'off'}),
>> 'enums': Textarea(attrs={'cols':30,
>> 'rows':5,'wrap':'off'}),
>> 'enums_annotations': Textarea(attrs={'cols':50,
>> 'rows':5,'wrap':'off'}),
>> 't_code': Textarea(attrs={'cols':15,
>> 'rows':5,'wrap':'off'}),
>> 't_string': Textarea(attrs={'cols

Re: Tools to document api

2014-02-27 Thread Timothy W. Cook
Are you using the django-rest-framework?

See:  http://www.django-rest-framework.org/topics/documenting-your-api

Swagger works great.




On Thu, Feb 27, 2014 at 3:41 AM,  wrote:

> I have a Django project in which i have written api interface to which i
> want to document.
> what are the best tools for documenting the api  ?
>
> --
> 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/50129fcb-772e-4f0d-b920-28814e5aa196%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3WBK1XtYAWRFHfQ_JqPGcuY6U56gccup6PJbsXP7no_OA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: collectstatic is not working

2014-02-27 Thread Timothy W. Cook
I think you need to set STATICFILES_DIRS  as well




On Thu, Feb 27, 2014 at 10:05 AM, Robin Lery  wrote:

> Hello,
> I have been trying to collect statics from the static folder but, its not
> collecting any files. But it did collect the admin files. What's wrong.
> Please help me.
>
> Thank you.
>
> *settings:*
>
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>
> STATIC_URL = '/static/'
>
> # Template location
> TEMPLATE_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
> )
>
> if DEBUG:
> MEDIA_URL = '/media/'
> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
> "static-only")
> MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
> STATIC_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "static-only"),
> )
>
> --
> 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/CA%2B4-nGrMV-y3YnSGnDVstKMu9h4f0kLH4qjSjwfQJOyGPxV5qw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3V-%3DabAkEW8fTK%3DFxKcZH47u4HR5%2B7FDqhWTk-kFQCn6w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Timothy W. Cook
Hi Andreas,

Thanks for the reply.


On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne
wrote:

> Hi Timothy,
>
> What you probably have to do is submit the form in a ajax call via jquery
> for example. https://api.jquery.com/jQuery.ajax/
>
> You create a request via the ajax method in jquery and then add a success
> and error handler. They only have to update the div you want to replace:
> $("#div_id").html(response).
>
>

This certainly seems like a reasonable approach.  The points I am unsure of
is:

1)  how do I catch the template error in jQuery?

2) I suppose that I have to (somehow) catch the error in the ModelForm?

3) then send that request to jQuery, somehow?

My forms and views are pretty simple at this point.  Here are examples:

class DvCodedStringCreateView(CreateView):
template_name = 'dvcodedstring_create.html'
success_url = '/dashboard'
model = DvCodedString
form_class = DvCodedStringCreateForm
fields =
['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',

'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',

'min_length','max_length','exact_length','enums','enums_annotations','default_value',]




class DvCodedStringCreateForm(forms.ModelForm):
class Meta:
model = DvCodedString
widgets = {
'data_name': TextInput(attrs={'size':90}),
'description': Textarea(attrs={'cols':80,
'rows':5,'wrap':'off'}),
'sem_attr': Textarea(attrs={'cols':15,
'rows':3,'wrap':'off'}),
'resource_uri': Textarea(attrs={'cols':60,
'rows':3,'wrap':'off'}),
'asserts': Textarea(attrs={'cols':80,
'rows':2,'wrap':'off'}),
'enums': Textarea(attrs={'cols':30,
'rows':5,'wrap':'off'}),
'enums_annotations': Textarea(attrs={'cols':50,
'rows':5,'wrap':'off'}),
't_code': Textarea(attrs={'cols':15,
'rows':5,'wrap':'off'}),
't_string': Textarea(attrs={'cols':30,
'rows':5,'wrap':'off'}),
't_abbrev': Textarea(attrs={'cols':10,
'rows':5,'wrap':'off'}),
't_version': Textarea(attrs={'cols':10,
'rows':5,'wrap':'off'}),
't_name': Textarea(attrs={'cols':40,
'rows':5,'wrap':'off'}),

   }



Thanks in advance for any further guidance.

--Tim




> 2014-02-27 12:38 GMT+01:00 Timothy W. Cook :
>
>> I have no idea where to start on this problem.
>> My application is work great using the admin UI but to enhance usability
>> it is time for a new user interface.
>>
>> I am using dynatree.js to create a 'Project' tree with subelements
>> (called PcTs) grouped into types;  IOW:  There are three levels before you
>> get to an editable component.  Hence the reason to use a tree instead of
>> paging through the admin UI.
>>
>> So my  UI (Selection_001.png)  uses  tags to layout the spaces.
>>  Basically tree on the left and a larger editing space next to it.  My
>> forms a re properly placed inside the scrollable .  My problem is when
>> I get an error in the form, how do I control it so that it is only
>> displayed in the same  where the form was displayed?  What I get now
>> is a full page reload. See Selection_002.png
>>
>> The template does not use any extend or include directives.  It is a
>> completely self contained HTML file.
>> There are forms and views for each of the PcTs.
>>
>>
>>  Any ideas on where to start working on this?
>>
>>
>>
>>
>>
>> --
>> MLHIM VIP Signup: http://goo.gl/22B0U
>> 
>> Timothy Cook, MSc   +55 21 994711995
>> MLHIM http://www.mlhim.org
>> Like Us on FB: https://www.facebook.com/mlhim2
>> Circle us on G+: http://goo.gl/44EV5
>> Google Scholar: http://goo.gl/MMZ1o
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>
&

Re: import

2014-02-11 Thread Timothy W. Cook
Welcome to the wonderful world of Python.  I suggest that you immerse
yourself in http://www.greenteapress.com/thinkpython/  and then take this
(free) course next month
https://www.coursera.org/course/interactivepython before tackling
anything like Django.

Best,
Tim




On Tue, Feb 11, 2014 at 8:26 AM, Johan Hendriks wrote:

> Hello all.
>
> I have a little question, maybe a little stupid but non the less it keeps
> me busy. :-)
>
> I want to start making some web based apps as a hobby project.
> I have no coding experience other then some basic shell scripting to get
> some daily routine jobs done on my FreeBSD servers.
> The first struggle I had to take is the programming language, I looked at
> PHP and python, and I think my best option is Python, and with python comes
> Django.
> So the last weeks i have been doing some searches on google and view a lot
> of tutorial video's how to start with django.
>
> One thing that always comes back is the import part like below
>
> from  django.http  import  HttpResponse
>
> And here comes my question, where and how do you know what you need to
> import.
> What is the best way to learn al these imports? , and is there a quick way
> to find the imports you need?
>
> Thank you for your time.
>
> regards
> Johan
>
>
>
> --
> 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/52F9FACB.5010108%40gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3XPbDZZE7e1SYm8e2cpDfWo%3DM3tviwgTXPHkyUmzQj83w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Custom User

2014-02-02 Thread Timothy W. Cook
Even if you user an alternate USER_MODEL should not put non-user specific
things there.

See
https://django-authtools.readthedocs.org/en/latest/intro.html#but-it-s-supposed-to-be-a-custom-user-model
 and the referenced links.





On Sun, Feb 2, 2014 at 6:18 PM, Henrique Oliveira <
henriqueollive...@gmail.com> wrote:

> Hi Timothy,
>
> I see it have officially deprecated the use of user profiles attached to
> the default user in favor of custom user models.
> One thing I have noticed in Django 1.6, only one AUTH_USER_MODEL can be
> used.
>
> Any ideas how to deal with this?
>
> On Sunday, February 2, 2014 4:26:44 PM UTC-2, Timothy W. Cook wrote:
>
>> I suggest, and I believe it is considered best practice by others.  To
>> create a profile model for your members with a one to one relationship to
>> the user.  Basically you do not want anything in the user model that
>> doesn't apply to all users.
>>
>>
>>
>>
>> On Sun, Feb 2, 2014 at 3:27 PM, Henrique Oliveira 
>> wrote:
>>
>>> Hi guys,
>>>
>>> I am building a gambling website thas has 2 types of users:
>>>
>>> Admin user: An user that manage that manages the website, it is a staff
>>> user(As already is done in Django), this user cannot register by yourself.
>>>
>>> Member user: It is an user that interact with the website, it has an
>>> account, a wallet, can bet, can register itself, this type of user has some
>>> custom fields,
>>> such as date of birth, cell phone number.
>>>
>>> What is the best way to deal with this requirement using Django?
>>>
>>> Cheers
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/44106a20-2cef-4be6-9981-4b11887fae68%
>>> 40googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> MLHIM VIP Signup: http://goo.gl/22B0U
>> 
>> Timothy Cook, MSc   +55 21 94711995
>> MLHIM http://www.mlhim.org
>> Like Us on FB: https://www.facebook.com/mlhim2
>> Circle us on G+: http://goo.gl/44EV5
>> Google Scholar: http://goo.gl/MMZ1o
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>
>  --
> 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/9dacec7c-7b0c-4f1b-a46d-4c3ed5fa65f7%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3W_2TENYOXqdFuh1P9iswU-1n0De2cymCk%3D2gRcugX9gA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Custom User

2014-02-02 Thread Timothy W. Cook
I suggest, and I believe it is considered best practice by others.  To
create a profile model for your members with a one to one relationship to
the user.  Basically you do not want anything in the user model that
doesn't apply to all users.




On Sun, Feb 2, 2014 at 3:27 PM, Henrique Oliveira <
henriqueollive...@gmail.com> wrote:

> Hi guys,
>
> I am building a gambling website thas has 2 types of users:
>
> Admin user: An user that manage that manages the website, it is a staff
> user(As already is done in Django), this user cannot register by yourself.
>
> Member user: It is an user that interact with the website, it has an
> account, a wallet, can bet, can register itself, this type of user has some
> custom fields,
> such as date of birth, cell phone number.
>
> What is the best way to deal with this requirement using Django?
>
> Cheers
>
> --
> 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/44106a20-2cef-4be6-9981-4b11887fae68%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3U5zSGhcLHyP2vXSS70Be4CzoFhvgY8YZVwqM0jpSAz3w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Timothy W. Cook
On Mon, Jan 27, 2014 at 2:22 PM, Mark Phillips
wrote:

>
> I have this at the top of the apache conf file for the site -
> WSGIPythonPath
> /home/django/.virtualenvs/inventory_project/lib/python2.7/site-packages/
>
> which is the correct path to the site packages directory. Perhaps another
> permissions problem?
>
>
Could be.  I would certainly check that you have correct group read
permissions down the entire path.

-- 
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/CA%2B%3DOU3VrJ_hctM0rCVKjfDU6zVtBXSMkXjSQEy_4uPtFY%3DVSKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   3   4   >