413 Payload Too Large on Django server

2019-03-15 Thread nate
Hey Django experts!

My team has been getting 413 errors whenever we try and upload large files 
to our Django back-end: 413 Payload too large

We can't exactly pin down the maximum acceptable file size - it seems to 
vacillate in the 1-3MB range.

Things we have excluded:

   - 
   
   It's not a webserver configuration issue, because we're running the
   Django server locally (without a webserver)
   - 
   
   We believe it's not an app server configuration issue, because this 
   happens on multiple app servers (./manage.py runserver and daphne -p 
   8000 topknott.asgi:application)
   - 
   
   It's not an issue with the field on the Django model, which looks 
   normal: photo = models.ImageField(blank=True)
   
Can anyone spot what we're missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/6cb0dfd7-f4f4-4d9d-b907-f0c792019187%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apply default filters in admin

2017-04-27 Thread Nate Granatir
That worked! Thanks!!

Nate

On Wednesday, April 26, 2017 at 6:37:32 AM UTC-5, Todor Velichkov wrote:
>
> I think `ModelAdmin.changelist_view 
> <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.changelist_view>`
>  
> is the right place.
>
> class MyModelAdmin(admin.ModelAdmin):
> def changelist_view(request, extra_context=None):
> if 'lang' not in request.GET:
> q = request.GET.copy()
> q.setdefault('lang', 'en')
> return redirect('%s?%s' % (request.path, q.urlencode()))
> return super(MyModelAdmin, self).changelist_view(
> request, extra_context=extra_context,
> )
>
>
>
>
> On Tuesday, April 25, 2017 at 2:08:33 AM UTC+3, Nate Granatir wrote:
>>
>> Where would I put that code? Is there a way to do it when the Admin form 
>> is initialized?
>>
>> On Monday, April 24, 2017 at 5:31:18 PM UTC-5, Todor Velichkov wrote:
>>>
>>> I think a simple redirect can fix your problem.
>>>
>>> Something like this:
>>>
>>> if 'lang' not in request.GET:
>>> q = request.GET.copy()
>>> q.setdefault('lang', 'en')
>>> return redirect('%s?%s' % (request.path, q.urlencode()))
>>>
>>>
>>>
>>>
>>> On Monday, April 24, 2017 at 7:12:18 PM UTC+3, Nate Granatir wrote:
>>>>
>>>> In my app I have admin filters for a field called "language" - language 
>>>> is a field in several of my models - and I've created them custom, 
>>>> inheriting from SimpleListFilter, so that I can apply a default of English 
>>>> when none has yet been specified. This works almost perfectly - the only 
>>>> problem is that if I do it this way, by altering the queryset in the admin 
>>>> filter when the user has not selected an option, the parameter is not 
>>>> displayed to the user in the GET paramaters of the URL, which I worry is 
>>>> confusing to the user. 
>>>>
>>>> Is there any way to solve this problem? Essentially I want to apply a 
>>>> default admin filter and have that filter appear in the URL as if it were 
>>>> chosen by the user. I am open to alternative solutions if anyone has done 
>>>> something like this before, even if it means a solution other than using a 
>>>> custom admin filter (e.g. some way of applying default GET parameters 
>>>> before the request is passed to the admin page.)
>>>>
>>>> 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/e7879f72-f991-4665-b0c7-3672530ebaee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apply default filters in admin

2017-04-24 Thread Nate Granatir
Where would I put that code? Is there a way to do it when the Admin form is 
initialized?

On Monday, April 24, 2017 at 5:31:18 PM UTC-5, Todor Velichkov wrote:
>
> I think a simple redirect can fix your problem.
>
> Something like this:
>
> if 'lang' not in request.GET:
> q = request.GET.copy()
> q.setdefault('lang', 'en')
> return redirect('%s?%s' % (request.path, q.urlencode()))
>
>
>
>
> On Monday, April 24, 2017 at 7:12:18 PM UTC+3, Nate Granatir wrote:
>>
>> In my app I have admin filters for a field called "language" - language 
>> is a field in several of my models - and I've created them custom, 
>> inheriting from SimpleListFilter, so that I can apply a default of English 
>> when none has yet been specified. This works almost perfectly - the only 
>> problem is that if I do it this way, by altering the queryset in the admin 
>> filter when the user has not selected an option, the parameter is not 
>> displayed to the user in the GET paramaters of the URL, which I worry is 
>> confusing to the user. 
>>
>> Is there any way to solve this problem? Essentially I want to apply a 
>> default admin filter and have that filter appear in the URL as if it were 
>> chosen by the user. I am open to alternative solutions if anyone has done 
>> something like this before, even if it means a solution other than using a 
>> custom admin filter (e.g. some way of applying default GET parameters 
>> before the request is passed to the admin page.)
>>
>> 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/64824070-5d41-4ec6-8ac4-8713b686233a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Apply default filters in admin

2017-04-24 Thread Nate Granatir
In my app I have admin filters for a field called "language" - language is 
a field in several of my models - and I've created them custom, inheriting 
from SimpleListFilter, so that I can apply a default of English when none 
has yet been specified. This works almost perfectly - the only problem is 
that if I do it this way, by altering the queryset in the admin filter when 
the user has not selected an option, the parameter is not displayed to the 
user in the GET paramaters of the URL, which I worry is confusing to the 
user. 

Is there any way to solve this problem? Essentially I want to apply a 
default admin filter and have that filter appear in the URL as if it were 
chosen by the user. I am open to alternative solutions if anyone has done 
something like this before, even if it means a solution other than using a 
custom admin filter (e.g. some way of applying default GET parameters 
before the request is passed to the admin page.)

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/2f33cad3-b3d0-45fb-b964-7118129e8462%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up an App and getting an import error

2017-04-07 Thread Nate Granatir
I may be speaking a bit out of my depth here, but I wonder if it's maybe 
because you haven't created __init__.py files in the directories? I believe 
Django (well, Python), requires an empty __init__.py file in directories 
when loading them as modules:
https://docs.python.org/3/tutorial/modules.html#packages

If it's not that, then I have no idea!

Nate

On Wednesday, April 5, 2017 at 11:28:23 AM UTC-5, jjander...@gmail.com 
wrote:
>
>
> Hi,
>
> I'm setting up a Django app using Django 1.10.3 and python 3.5.2. When I 
> run the following command in my 3.5.2 virtual environment:
>
>   
>
> *python manage.py runserver*prior to entering the  app in INSTALLED_APPS 
> in settings.py, my webpage comes up fine.
>
>
> When I add the following line to INSTALLED_APPS:
>
>   *  'util.siggy.apps.SiggyConfig',*
>
> I get the following error message:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Unhandled exception in thread started by  check_errors..wrapper at 0x7f47313e7620>Traceback (most recent call 
> last):  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py",
>  
> line 226, in wrapperfn(*args, **kwargs)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/core/management/commands/runserver.py",
>  
> line 113, in inner_runautoreload.raise_last_exception()  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py",
>  
> line 249, in raise_last_exceptionsix.reraise(*_exception)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/six.py", 
> line 685, in reraiseraise value.with_traceback(tb)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py",
>  
> line 226, in wrapperfn(*args, **kwargs)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/__init__.py", line 
> 27, in setupapps.populate(settings.INSTALLED_APPS)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/apps/registry.py", 
> line 85, in populateapp_config = AppConfig.create(entry)  File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/apps/config.py", 
> line 116, in createmod = import_module(mod_path)  File 
> "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)  File " importlib._bootstrap>", line 986, in _gcd_import  File " importlib._bootstrap>", line 969, in _find_and_load  File " importlib._bootstrap>", line 944, in _find_and_load_unlocked  File " importlib._bootstrap>", line 222, in _call_with_frames_removed  File 
> "", line 986, in _gcd_import  File " importlib._bootstrap>", line 969, in _find_and_load  File " importlib._bootstrap>", line 956, in _find_and_load_unlockedImportError: No 
> module named 'util.siggy'*In my project directory, I have a path 
> .../project_dir/util/siggy/apps.py that has the class SiggyConfig defined 
> in it.
>
> It looks to me that python is not finding my util/siggy directory, but I'm 
> not sure why. I included a print statement
> in manage.py and it prinsts out the sys.path as:
>
>
>
>
>
>
>
>
>
> *['/home/jja/prog/dev/newSiggy', 
> '/home/jja/testenv3.5/lib/python3.5/site-packages/django_classy_tags-0.8.0-py3.5.egg',
>  '/home/jja/testenv3.5/lib', '/usr/lib/python35.zip', '/usr/lib/python3.5', 
> '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', 
> '/home/jja/testenv3.5/lib/python3.5/site-packages']*
>
> where /home/jja/prog/dev/newSiggy is the path to my Django project root.
>
> The full path to my app is /home/jja/prog/dev/newSiggy/util/siggy/apps.py.
>
> It is a mystery to my why python cannot find 'util.siggy'.
>
> I've looked on the web and have not found a case that seems to match mine 
> (some are close). I have tried changing a few
> path related settings, but so far, no success.
>
> Any suggestions on what to try next?
>
> Jim A.
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/cd7eca9e-7ea2-4bcd-8c05-97bedc26cd6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to design High Scalability architecture with Django in cost effective fashion

2017-04-03 Thread Nate Granatir
I am also not even close to being an expert on this topic, but I do know 
that it's super easy to deploy a Django app on Heroku, which will get you 
scalable app deployment and Postgres dbs with very little upfront effort.
https://devcenter.heroku.com/articles/deploying-python

Nate

On Sunday, April 2, 2017 at 1:54:46 PM UTC-5, Mihir Sevak wrote:
>
> Hi All,
>   I am wondering if there are any books, articles or any other 
> resources from where I can learn about how to create a highly scalable 
> architecture using Django. We are talking about distributed systems and 
> most likely one which is hosted on a third party cloud solution like AWS. 
> That being the case cost effectiveness is a concern as well. 
>
> Several years ago I used to work with LexisNexis on their super computer 
> with 6400 nodes. We had designed the system in a way that depending on 
> load, nodes will be turned on and off automatically saving us bandwidth 
> usage and electricity/power usage. I am envisioning similar architecture 
> using Django. However, I have no clue how to put multiple database back end 
> with same django frontend or what does middleware do or if we have 15 
> different django applications running to create a whole functional website 
> how to distribute those 15 applications among nodes etc etc. 
>
> I am really a newbee in django architecture and because I don't know 
> enough about django I don't know how to leverage distributed architecture 
> and make django work with it. 
>
> If anyone can share any education material about how Django is 
> architectured in order to build distributed systems effectively and 
> reliably that would be absolutely wonderful. If there are any open source 
> projects which I can take a look at and learn that would be great as well.  
>
>
> Thanks.
> Have a great day and wonderful weekend.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/18007f34-2ecb-4736-a05a-7e857f437571%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


inline parent value

2016-12-10 Thread Nate Granatir
You should be able to customize the queryset of any form by overriding it in 
the init method of the form. In this case, it's a little trickier because 
you'll need a custom admin and custom form for the inline. I haven't been able 
to test this, but I think you'll need to do the following. 

In forms.py, add a custom inline form, and in the init method customize the 
queryset to whatever it needs to be, after calling super, e.g.:

class OrderRowsInlineForm(forms.ModelForm):
class Meta:
model = None
fields = '__all__'

def __init__(self, *args, **kwargs):
super(OrderRowsInlineForm, self).__init__(*args, **kwargs)
self.fields['product'].queryset = 
Product.objects.filter(brand='whatever')


Then in admin.py, import the form and add a custom admin for the inline that 
uses that custom form, like:

from forms import OrderRowsInlineForm

class OrderRowsInline(admin.TabularInline):
model = OrderRows
form = OrderRowsInlineForm


Now, depending on what you want to set the queryset to, you might run into some 
trouble; if the list of brands for an order row depends on the brand in the 
product, you might have to do some trickery to pass the proper brand (or brand 
id) down into the form. You can generally use self.instance, but if these are 
new records that haven't been saved yet (i.e. the user will be filling in the 
details and clicking Save), which i assume is true, then i believe 
self.instance is None until saved, so won't be useful here. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/289175e1-c741-464f-bb25-66c9809e1cc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Annotate a List of Values

2016-11-18 Thread Nate Granatir
As demonstrated 
here: https://docs.djangoproject.com/en/1.10/topics/db/examples/many_to_many/
If you have a ManyToMany relationship set up in your models, say:


class SerialNumber(models.Model):
serial = models.CharField(max_length=50)


class Item(models.Model):
item_name = models.CharField(max_length=100)
serial_numbers = models.ManyToManyField(SerialNumber)


Then you can get a list of all serials for an item with:


item.serial_numbers.all()


On Thursday, November 17, 2016 at 1:26:34 PM UTC-6, Matthew Pava wrote:
>
> I am trying to annotate a list of values on a queryset.
>
> Basically, I have a model of Items that are associated many to many to 
> Serial Numbers, and I want for each distinct Item the list of all Serial 
> Numbers for that Item.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/4e58317a-4fbb-4e4f-a8c8-2e01414c679a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SQLAchemy

2016-11-04 Thread Nate Granatir
Yes, why are you using SQLAlchemy instead of Django's built-in ORM? I don't 
see any reason to even attempt this unless you need to perform operations 
outside the context of Django. 

On Wednesday, November 2, 2016 at 2:09:18 AM UTC-5, pradam.programming 
wrote:
>
> hi,
> I am new to SqlAchemy.My questions are as follows:
> 1.When i write tables in sql achemy format i can't able to do 
> makemigrations and migrate..?
> 2.In SqlAchemy Explicitly i need to specify  database whenever i do CRUD 
> operations ?
> 3.Whats the main advantage over SQLAchemy vs Django OMR.?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/57c94673-64b3-436f-ba70-5eb6921f9b7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-11-04 Thread Nate Granatir
Or why not just assign certain Users to certain Groups? That seems like a 
much more clean and simple way of handling the problem. You'd be able to 
easily filter either set of users, and it would require very little custom 
code. Plus, doing something like assigning negative IDs disguises what 
you're actually trying to accomplish, whereas auto-assigning certain users, 
to, say, a group called "Service Accounts", is perfectly clear to anyone 
looking at the code.

Nate

On Wednesday, October 26, 2016 at 7:25:20 PM UTC-5, mic...@zanyblue.com 
wrote:
>
> Hi,
>
> The Django contrib User model is used to create accounts in Django 
> applications.  I would like to keep accounts associated with real people 
> separate from accounts created for mailing list and/or service accounts.  I 
> was planning on using negative ID's for these accounts and can't see any 
> issue with this from a Django or DB point of view (would need to create and 
> manage my own sequence for this).
>
> Can anyone see any issue with this?
>
> Take care,
> Michael.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/9b047cee-4208-42fa-bd1d-613403dc1a87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
Just realized this thread was not necessarily about filters for the admin; 
in the case of using custom forms/views Django daterange filter may not be 
a good option.

On Thursday, March 19, 2009 at 8:37:56 AM UTC-5, Paul Nema wrote:
>
> I've noticed many people new to Django (and sometimes also new to Python) 
> often post the same/similar questions in various forums. How to I get 
> something to work and/or do you have an example for X. As I've also 
> experienced this problem I've decided to post my little solution. Its not 
> the only way to do this, just the way I did it. Hopefully this will provide 
> the answer people are searching for or at least get them started. I guess 
> it will also serve as a quick code review by those so inclined to comment.
>
>
> You've probably heard of DRY but I think something is missing. There 
> should also be a Don't Repeat Other's Work (DROW) when they already solved 
> the problem. Thus another motivation to post this.  On a side note there is 
> a bit of debate out there about using the Django AdminDateWidget verse 
> other solutions (Jquery, etc). Your decision to make but why increase 
> dependencies when you don't have to.
>
>
> As I'm still learning Django everything in the code below may not be 
> required but I'm listing it anyway. You may need to modify to your 
> particular environment.  As I don't have a blog to post this I'm sending it 
> to this group. I'm open to any suggestions for a better place to post this.
>
>
> For this example I will focus on adding a date picker for date of birth 
> (dob) and a date time picker for sponsor sign date (sponsor_sign_date). Key 
> items are in *Bold*.
>
>
> Another reference to adding the AdminDateTime widget is here: 
> http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form
>
>
>
>
> ---
>
> My top level (django-admin.py startproject izbo) directory Structure:
>
> mylogin@LX-D620:~/dev/izbo$ ll
>
> drwxrwxr-x 2 mylogin mylogin 4096 2009-03-17 10:52 account/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:53 add/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 04:34 adjudicator/ 
>
> drwxrwxr-x 2 mylogin mylogin 4096 2009-03-18 09:43 application/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 10:06 contract/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-03-18 09:49 DB/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:51 employer/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 04:34 entity/ 
>
> -rw-r--r-- 1 mylogin mylogin 207 2009-03-08 04:54 exclude 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-03-18 10:06 gzbo/ 
>
> -rw-r--r-- 1 mylogin mylogin 0 2009-01-06 04:55 __init__.py 
>
> -rw-r--r-- 1 mylogin mylogin 546 2009-01-06 04:55 manage.py 
>
> drwxrwxrwx 5 mylogin mylogin 4096 2009-02-08 12:35 media/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:53 member/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:52 note/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-02-20 12:47 search/ 
>
> -rw-r--r-- 1 mylogin mylogin 4192 2009-03-05 23:39 settings.py 
>
> drwxrwxrwx12 mylogin mylogin 4096 2009-03-16 11:48 templates/ 
>
> -rw-r--r-- 1 mylogin mylogin 2118 2009-03-16 11:16 urls.py 
>
>
> --
>
> Media directory Listing:
>
> mylogin@LX-D620:~/dev/izbo/media$ ll 
>
> total 12 
>
> drwxr-xr-x 5 mylogin mylogin 4096 2009-03-18 10:56 admin/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-02-07 15:45 css/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-01-27 10:07 images/ 
>
> lrwxrwxrwx 1 mylogin mylogin 36 2009-03-18 11:07 img -> 
> /home/mylogin/dev/izbo/media/admin/img/ 
>
>
> * Note: admin/ is 'cp -r' of directory 
> /usr/lib/python2.5/site-packages/django/contrib/admin/media.  Then I linked 
> the img directory.
>
>
>
> 
>
> In my “settings.py”
>
>
> import os.path 
>
> PROJECT_DIR = os.path.dirname(__file__) 
>
>
> MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') 
>
> MEDIA_URL = 'http://www.izbo.com/media/'
>
> *ADMIN_MEDIA_PREFIX = '/media/admin/'*
>
> TEMPLATE_DIRS = ( 
>
>os.path.join(PROJECT_DIR, 'templates'),
>
>...
>
> )
>
>
> 
>
> In my top level “urls.py” file
>
> *from django.contrib import admin * 
>
>
> urlpatterns = patterns('', 
>
># Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
>
># to INSTALLED_APPS to enable admin documentation: 
>
>(r'^admin/doc/', include('django.contrib.admindocs.urls')), 
>
>
>*# Add this to get widgets.AdminDateWidget() working for non is_staff, 
> is_superuser * 
>
>*# This must be placed before (r'^admin/(.*)', admin.site.root), as 
> that gobals up everything * 
>
>*(r'^admin/jsi18n/$', 'django.views.i18n.javascript_catalog'), * 
>
>
># Uncomment the next line to enable the admin: 
>
>(r'^admin/(.*)', admin.site.root), 
>
>
># IZBO related URLs 
>
>(r'^$', splash), 
>
>.
>
> )
>
>
>
> -
>
> In “gzbo/models.py” I have my class
>
>
> # 
>
> # Application 
>
> # 
>
> class App (Record) : 
>
> # P

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
I just installed Django Daterange Filter 1.3.0 
(https://github.com/DXist/django-daterange-filter) on a Django 1.9 project. 
Took a little CSS fiddling to get it to display properly with Grappelli, 
but other than that it worked like a charm.

Nate


On Thursday, March 19, 2009 at 8:37:56 AM UTC-5, Paul Nema wrote:
>
> I've noticed many people new to Django (and sometimes also new to Python) 
> often post the same/similar questions in various forums. How to I get 
> something to work and/or do you have an example for X. As I've also 
> experienced this problem I've decided to post my little solution. Its not 
> the only way to do this, just the way I did it. Hopefully this will provide 
> the answer people are searching for or at least get them started. I guess 
> it will also serve as a quick code review by those so inclined to comment.
>
>
> You've probably heard of DRY but I think something is missing. There 
> should also be a Don't Repeat Other's Work (DROW) when they already solved 
> the problem. Thus another motivation to post this.  On a side note there is 
> a bit of debate out there about using the Django AdminDateWidget verse 
> other solutions (Jquery, etc). Your decision to make but why increase 
> dependencies when you don't have to.
>
>
> As I'm still learning Django everything in the code below may not be 
> required but I'm listing it anyway. You may need to modify to your 
> particular environment.  As I don't have a blog to post this I'm sending it 
> to this group. I'm open to any suggestions for a better place to post this.
>
>
> For this example I will focus on adding a date picker for date of birth 
> (dob) and a date time picker for sponsor sign date (sponsor_sign_date). Key 
> items are in *Bold*.
>
>
> Another reference to adding the AdminDateTime widget is here: 
> http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form
>
>
>
>
> ---
>
> My top level (django-admin.py startproject izbo) directory Structure:
>
> mylogin@LX-D620:~/dev/izbo$ ll
>
> drwxrwxr-x 2 mylogin mylogin 4096 2009-03-17 10:52 account/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:53 add/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 04:34 adjudicator/ 
>
> drwxrwxr-x 2 mylogin mylogin 4096 2009-03-18 09:43 application/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 10:06 contract/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-03-18 09:49 DB/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:51 employer/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-18 04:34 entity/ 
>
> -rw-r--r-- 1 mylogin mylogin 207 2009-03-08 04:54 exclude 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-03-18 10:06 gzbo/ 
>
> -rw-r--r-- 1 mylogin mylogin 0 2009-01-06 04:55 __init__.py 
>
> -rw-r--r-- 1 mylogin mylogin 546 2009-01-06 04:55 manage.py 
>
> drwxrwxrwx 5 mylogin mylogin 4096 2009-02-08 12:35 media/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:53 member/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-03-17 10:52 note/ 
>
> drwxr-xr-x 2 mylogin mylogin 4096 2009-02-20 12:47 search/ 
>
> -rw-r--r-- 1 mylogin mylogin 4192 2009-03-05 23:39 settings.py 
>
> drwxrwxrwx12 mylogin mylogin 4096 2009-03-16 11:48 templates/ 
>
> -rw-r--r-- 1 mylogin mylogin 2118 2009-03-16 11:16 urls.py 
>
>
> --
>
> Media directory Listing:
>
> mylogin@LX-D620:~/dev/izbo/media$ ll 
>
> total 12 
>
> drwxr-xr-x 5 mylogin mylogin 4096 2009-03-18 10:56 admin/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-02-07 15:45 css/ 
>
> drwxrwxrwx 2 mylogin mylogin 4096 2009-01-27 10:07 images/ 
>
> lrwxrwxrwx 1 mylogin mylogin 36 2009-03-18 11:07 img -> 
> /home/mylogin/dev/izbo/media/admin/img/ 
>
>
> * Note: admin/ is 'cp -r' of directory 
> /usr/lib/python2.5/site-packages/django/contrib/admin/media.  Then I linked 
> the img directory.
>
>
>
> 
>
> In my “settings.py”
>
>
> import os.path 
>
> PROJECT_DIR = os.path.dirname(__file__) 
>
>
> MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') 
>
> MEDIA_URL = 'http://www.izbo.com/media/'
>
> *ADMIN_MEDIA_PREFIX = '/media/admin/'*
>
> TEMPLATE_DIRS = ( 
>
>os.path.join(PROJECT_DIR, 'templates'),
>
>...
>
> )
>
>
> 
>
> In my top level “urls.py” file
>
> *from django.contrib import admin * 
>
>
> urlpatterns = patterns('', 
>
># Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
>
># to INSTALLED_APPS to enable admin documentation: 
>
>

Re: Django template iterating through two dictionaries/variables

2016-08-30 Thread Nate Granatir
You could also just join the dicts before passing them to the template. It 
looks like it's relatively straightforward (scores is just a list that 
contains dicts of a 'Number' and a 'score', right?) Then you could turn 
scores into a dict, assuming Numbers are unique:

scores_new = {score['Number']:score['score'] for score in scores}

And then update the persons dict to include the score:
for person in persons:
person.update({'score': scores_new.get(person['Number'])})

Then in your persons list in the template you'll just need to display 
person.score.

If you want to get really fancy (if, say, there's more than just a score 
you need to pull from the dicts in scores) you can see how to merge two 
lists of dicts on a common key here:
http://stackoverflow.com/questions/5501810/join-two-lists-of-dictionaries-on-a-single-key

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


Re: Beginner question regarding virtualenv

2016-06-24 Thread Nate Granatir
I've found that virtualenvs are definitely worth the time to set up, there 
will be a time down the road when you need to have two different versions 
of the same package. Also, I'd strongly recommend storing the project's 
dependencies in a requirements.txt file. I have a terrible memory and would 
never remember which versions are compatible with my project and which 
aren't.

As mentioned above, your IDE may help you set up and use virtualenvs. I use 
PyCharm and it can create the environment for you and associate that with 
your project.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/ba9c488d-b563-4822-867d-5463869fe49b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How and where should I put a version number in my Django project?

2016-05-03 Thread Nate Granatir
You can put the version for your project in:
my_project/my_project/__init__.py (same folder as settings.py)
like this:

__version__ = '1.0.27'


Then your project acts as a python module, and you can refer to the version 
number, for instance in your settings.py, as:

GRAPPELLI_ADMIN_TITLE = 'My Project v{}'.format(my_project.__version__)


(Here the Grappelli plugin uses this in the headers of all its admin 
templates.)

Nate


On Tuesday, May 3, 2016 at 4:21:38 AM UTC-5, Martin Torre Castro wrote:
>
> I'm making a Django project consisting of several apps and I want to use a 
> version number for the whole project, which would be useful for tracking 
> the status of the project between each time it comes to production.
>
>
> I've read and googled and I've found how to put a version number for each 
> django app of mine, but not for a whole project.
>
> I assume that the *settings.py* (in my case it would be base.py, because 
> the settings are inherited for each environment: developmente, 
> pre-production, production) would be the ideal file for storing it, but I 
> would like to know good practices from other Django programmers, because I 
> haven't found any.
>
>
> Thank you in advance
>

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


Having a hard time installing Graphite on Windows 7

2014-07-12 Thread &#x27;nate dingo' via Django users
I am following the instruction on this document.

http://www.s2-industries.com/wordpress/2013/01/running-graphite-webapp-on-windows



   - Install Python 2.7 (as mentioned in the other blog post)
   - Install PyPi (as mentioned in the other blog post)
   - Install PythonGTK+ (for Cairo graphics) from here 
   
<http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.0.win32-py2.7.msi>
   - Install Django using a package from here 
   <https://www.djangoproject.com/download/>. In my case, I used Django 
   1.4.2. Drop me a message if Graphite WebApp also works with newer versions 
   of Django. 
   - Install twisted using: 
   
   pip install Twisted
   
   - Install zope.interface using: 
   
   pip install zope.interface
   
   
Then where do I go? I have also installed GitHub and Pycairo, and 
"pygtk-all-in-one-2.24.0.win32-py2.7(2).msi"

Whisper scripts are in my python27/scripts but carbon and web-apps produce 
error messages when I try to load them using:

git clone https://github.com/graphite-project/graphite-web.git
git clone https://github.com/graphite-project/carbon.git
git clone https://github.com/graphite-project/whisper.git


Am I even in the ball park?

Thanks
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/b344e879-b4f2-4b98-b2ea-8e096d463c4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bilingual Content Creation

2014-04-23 Thread Nate
I'm making a Django site that will have Spanish and English content.

I know I will be using 
i18n. 
I want users to be able to create and translate content easily from the 
django admin. 

I am wondering how I should implement this.

I've looked at these apps:

   - Rosetta 
   - transdb 
   - multi-lingual 

And I've also read that one option would be to create duplicate model 
fields renamed with _en and _es suffixes accordingly.

What's the slickest route to go?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/1422c693-2dc2-4f3a-b358-be8886d6718b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Noobie questions about Django and Databases

2013-05-08 Thread Nate Aune


> What I had planned to "learn by doing", is building a site that scrapes 
> the prices of baseball bats from about 20 different websites and displays 
> the best price when a user searches based on the model of the baseball / 
> softball / teeball bat.  
>

Check out the 
django-dynamic-scraper: http://django-dynamic-scraper.readthedocs.org/
 
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Encrypting PK in URL

2012-03-06 Thread nate
I saw a thread on this previously but it does not seem to have a solution.  
I used this thread 
http://stackoverflow.com/questions/2291176/django-python-and-link-encryption 
as a base and created encrypt and decrypt functions for the pk.  I encrypt 
and quote and use smart_unicode to create my url.  They come out looking 
something like this:  %FA8%01%5B%9D%93_%B6%F5%3D%3A%23ij%01%8B.  it does 
not work.  I changed the core as mentioned on this ticket 
https://code.djangoproject.com/attachment/ticket/5738/unicode_url_bug.patch 
and I was able to get the error it was throwing.  The encrypted URL does 
not seem to be going thru all the way as the URL in the error statements 
looks something like this: _ij .  Is there another approach I can take? or 
Am I missing something here?  Also the url is set to something like this: 
/path/(.+)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hfIb0PLTs2YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sending django email via gmail

2012-03-06 Thread nate
everything looks correct.  I also use gmail and I have exactly what you 
have and it is working for me.  The only difference I see is the order and 
I'm not sure if that makes a difference.  My order is:

EMAIL_USE_TLS
EMAIL_HOST
EMAIL_PORT
EMAIL_HOST_USER
EMAIL_HOST_PASSWORD

Also are you using regular gmail or google apps???


On Tuesday, March 6, 2012 12:28:56 PM UTC-5, hack wrote:
>
> I'm attempting to send a message from my django app via gmail and keep
> getting a connection refused error even though I know the parameters
> are correct.
>
> settings.py
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = '587'
> EMAIL_USE_TLS = True
> EMAIL_HOST_USER = 'myu...@gmail.com'
> EMAIL_HOST_PASSWORD = 'password'
>
> idle command:
> send_mail('My First Subject','My First Email Message in
> DJango','myu...@gmail.com',['someb...@gmail.com'],fail_silently=False)
>
> I am able to send email through my mail client (Thunderbird).
>
> Any insight on this matter would be greatly appreciated.  Thanks.
>
> * The error message is below 
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Library/Python/2.6/site-packages/django/core/mail/__init__.py",
> line 61, in send_mail
> connection=connection).send()
>   File "/Library/Python/2.6/site-packages/django/core/mail/message.py",
> line 251, in send
> return self.get_connection(fail_silently).send_messages([self])
>   File 
> "/Library/Python/2.6/site-packages/django/core/mail/backends/smtp.py",
> line 79, in send_messages
> new_conn_created = self.open()
>   File 
> "/Library/Python/2.6/site-packages/django/core/mail/backends/smtp.py",
> line 42, in open
> local_hostname=DNS_NAME.get_fqdn())
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 239, in __init__
> (code, msg) = self.connect(host, port)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 295, in connect
> self.sock = self._get_socket(host, port, self.timeout)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 273, in _get_socket
> return socket.create_connection((port, host), timeout)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py",
> line 512, in create_connection
> raise error, msg
> error: [Errno 61] Connection refused
>
>
> -- 
> Scott
>
>
On Tuesday, March 6, 2012 12:28:56 PM UTC-5, hack wrote:
>
> I'm attempting to send a message from my django app via gmail and keep
> getting a connection refused error even though I know the parameters
> are correct.
>
> settings.py
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = '587'
> EMAIL_USE_TLS = True
> EMAIL_HOST_USER = 'myu...@gmail.com'
> EMAIL_HOST_PASSWORD = 'password'
>
> idle command:
> send_mail('My First Subject','My First Email Message in
> DJango','myu...@gmail.com',['someb...@gmail.com'],fail_silently=False)
>
> I am able to send email through my mail client (Thunderbird).
>
> Any insight on this matter would be greatly appreciated.  Thanks.
>
> * The error message is below 
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Library/Python/2.6/site-packages/django/core/mail/__init__.py",
> line 61, in send_mail
> connection=connection).send()
>   File "/Library/Python/2.6/site-packages/django/core/mail/message.py",
> line 251, in send
> return self.get_connection(fail_silently).send_messages([self])
>   File 
> "/Library/Python/2.6/site-packages/django/core/mail/backends/smtp.py",
> line 79, in send_messages
> new_conn_created = self.open()
>   File 
> "/Library/Python/2.6/site-packages/django/core/mail/backends/smtp.py",
> line 42, in open
> local_hostname=DNS_NAME.get_fqdn())
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 239, in __init__
> (code, msg) = self.connect(host, port)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 295, in connect
> self.sock = self._get_socket(host, port, self.timeout)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py",
> line 273, in _get_socket
> return socket.create_connection((port, host), timeout)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py",
> line 512, in create_connection
> raise error, msg
> error: [Errno 61] Connection refused
>
>
> -- 
> Scott
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/erpoNhyrzJ0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google

Re: Json serialization help

2011-08-16 Thread Nate
Thank you for the suggestion.
I actually ended up extending Django's json serializer.  Here is the
code in case you or someone else needs to do something like this.

from django.core.serializers.json import Serializer as JsonSerializer
from django.utils.encoding import is_protected_type
class DisplayNameJsonSerializer(JsonSerializer):

def handle_field(self, obj, field):
value = field._get_val_from_obj(obj)

#If the object has a get_field_display() method, use it.
display_method = "get_%s_display" % field.name
if hasattr(obj, display_method):
self._current[field.name] = getattr(obj, display_method)()

# Protected types (i.e., primitives like None, numbers, dates,
# and Decimals) are passed through as is. All other values are
# converted to string first.
elif is_protected_type(value):
self._current[field.name] = value
else:
self._current[field.name] = field.value_to_string(obj)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Json serialization help

2011-08-14 Thread Nate
Hello,

I'm new to Django and having a problem with serialization.

I am trying to serialize a model that has a CharField with choices,
and the json serializer returns json with the choices' database values
instead of display values.
Is there a way to get the json serializer to use the choices's display
values?

Here is a brief example (I haven't tested it but I think it
illustrates the problem):

In the models file:
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Foo(models.Model):
SAMPLE_CHOICES = (('db_name1', _('Display Name 1')),
('db_name_2',_('Display Name 2')))
choice_field = models.CharField(max_length = 10, choices =
SAMPLE_CHOICES)

If there is one Foo in the database, with a value of db_name1 for
choice_field, and I call get_foo_json(), with:

def get_foo_json()
foos = Foo.objects.all()
json_serializer = serializers.get_serializer("json")()
response = HttpResponse()
json_serializer.serialize(foos, ensure_ascii=False,
stream=response)
return response

The response is something like:
'Content-Type: text/html; charset=utf-8\n\n[{"pk": 1, "model":
"MyApp.foo", "fields": {"choice_field": "db_name1"}}]'

I would like to get something like:
'Content-Type: text/html; charset=utf-8\n\n[{"pk": 1, "model":
"MyApp.foo", "fields": {"choice_field": "Display Name 1"}}]'

Thank you for your help,

-Nate



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Setting up EC2 for Django

2011-07-05 Thread Nate Aune
If you don't need SSH access to the machines that power this whole setup, 
you can use DjangoZoom, our one-click Django deployment and hosting service. 
It's built on top of Amazon and uses Nginx, PostgreSQL and as of a few days 
ago, we also now support Mercurial. The only gotcha might be Solr which we 
don't support yet, but you could probably connect a 3rd party Solr provider 
such as http://websolr.com to satisfy that requirement.

Sign up for the beta at http://djangozoom.com and mention that you heard 
about it on this thread to get an invite.

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/skUgBuGRWgsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django News Site Resources

2011-04-08 Thread Nate Aune
You might be interested in an emerging Django-based CMS for building news 
sites called ArmstrongCMS. It's expected to be released in June, and you can 
read more about it at http://armstrongcms.org

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: framework web comparison

2011-04-07 Thread Nate Aune
You might find some answers in the recent survey that Boston companies using 
Django filled out. You can see the results of the survey here:
http://djangozoom.com/blog/2011/04/03/companies-boston-using-django/

We asked 3 simple questions:


   - What are you using Django for?
   - Why did you choose Django?
   - How long have you been using Django?

45 companies have shared what they are using Django for and why they chose 
Django over competing web frameworks. Jesse Noller from Nasuni also shared 
his reasons for choosing Django 
here: http://www.nasuni.com/news/nasuni-blog/thanks-to-django/

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on EC2

2011-03-20 Thread Nate Aune
For the DjangoZoom.com infrastructure we use the Ubuntu 10.10 AMIs provided 
by Canonical. We use the 32-bit and 64-bit images in us-east region: 
http://uec-images.ubuntu.com/releases/maverick/release/

They've also published a pretty good getting started with EC2 page 
here: https://help.ubuntu.com/community/EC2StartersGuide

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django based Project Management software

2011-03-18 Thread Nate Aune
You may want to check out http://scrumdo.org which is a Scrum-based project 
management software package written in Django. There is a hosted version 
(http://scrumdo.com) as well.

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is the best server for Django

2011-03-18 Thread Nate Aune
I can't help you with your WebFaction questions, but I'd like to hear more 
about your needs for reselling Django hosting for your customers. Do you 
expect that you will give your customers access to their own hosting 
account, or will you manage this for them and just pass on the costs to 
them?

Nate

On Friday, March 11, 2011 10:29:14 AM UTC-5, andreap wrote:
>
> Im using webfaction and its the best! 
>
>
> I have 2 question, 
>
> 1 How can I make an online backup with webfaction? 
>
> 2  I start to have new customers and I need a hosting to resell to my 
> customers. Can I use webfaction but actually I can only buy new ram 
> for my hostcan I buy one hosting per customer? 
>
> thx 
> Andrea 
>
> -- 
> suite.guz.it django CRM e CMS 
>
>
>
> On 11 Mar, 10:46, Kenneth Gonsalves  wrote: 
> > On Fri, 2011-03-11 at 01:33 -0800, shofty wrote: 
> > > i tried djangohosting.ch after webfaction. webfaction have better 
> > > support 
> > > response times which as a noob i needed. wf have some incredibly 
> > > knowledgable staff on their support team. so it depends what you want. 
> > > dh 
> > > have a great installer, so long as you know what you're doing they're 
> > > a good 
> > > choice. first installation might not be too easy but after that... 
> > 
> > you do not really need to use their installer. I have set up some sites 
> > there and I just do the standard virtualenv stuff - feels like I am on 
> > my laptop. The do not give root access, but one gets ones own 
> > configurable instance of apache - what more do you want? 
> > -- 
> > regards 
> > KGhttp://lawgon.livejournal.com 
> > Coimbatore LUG roxhttp://ilugcbe.techstud.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app and Amazon AWS (beginner)

2011-03-18 Thread Nate Aune
What do you mean by custom settings? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Mingus vs Zinnia

2011-03-16 Thread Nate Aune
We're using Zinnia for http://djangozoom.com/blog and it's working pretty 
well. We wanted to embed Youtube videos and TinyMCE was stripping out the 
 tags, so we had to override the .js to get TinyMCE to allow the 
iframe tags.

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with Apache/Nginx combo

2011-03-16 Thread Nate Aune
You might want to try Nginx proxying to Gunicorn. This is what we use for 
DjangoZoom and it works really well. Pretty easy to set up as well. Here are 
a few resources that provide instructions for how to set it up:
http://www.rkblog.rk.edu.pl/w/p/deploying-django-project-gunicorn-and-nginx/
http://ericholscher.com/blog/2010/aug/16/lessons-learned-dash-easy-django-deployment/
http://davidpoblador.com/run-django-apps-using-gunicorn-and-nginx/

Or if you don't want to mess around with Nginx/Apache/Gunicorn 
configuration, our DjangoZoom service takes care of all of this stuff for 
you. We check out your code and in less than a minute, return a public URL 
of your live running app. You never even have to touch the server! 

We're focused on providing the best deployment and hosting experience for 
Django developers. 

If you want to try it out, sign up for the beta and we'll try to get you an 
invite soon! http://bit.ly/ezSkKA

thanks,
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app and Amazon AWS (beginner)

2011-03-16 Thread Nate Aune
Hi Nai,

It takes some tinkering to get a production deployment of a Django app 
working well. One of the founders of Django, Jacob Kaplan Moss, presented a 
Django deployment workshop at last year's PyCon.  Video: 
http://pycon.blip.tv/file/3632436/  
Code: https://github.com/jacobian/django-deployment-workshop  

If you want to get your Django app deployed up on Amazon's infrastructure 
and don't want to mess around with config files and servers, I invite you to 
try out our DjangoZoom service which is built on top of Amazon's AWS 
infrastructure. http://djangozoom.com  We take care of all the server-side 
stuff, so you don't have to. 

You just point us at your code repo and in less than a minute, we return a 
public URL of your live running app. The service is in a private beta right 
now, but if you sign up for the beta, we'll try to get an invite to you 
soon.  We welcome any feedback on how to make it the best hosting service 
for Django developers!

thanks,
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Deploying django. Please specify the steps.

2011-03-15 Thread Nate Aune
You are not alone. We've seen many folks struggle with the deployment of 
Django. It can be done but it requires some reading up on documentation on 
various components in the stack. I suggest that you watch Jacob Kaplan Moss' 
Django deployment workshop video at: http://pycon.blip.tv/file/3632436/

If you'd rather not have to deal with the complexities of deploying your 
Django app to a production server, I welcome you to try out 
DjangoZoom<http://djangozoom.com>, 
a turnkey deployment and hosting platform specifically designed with the 
needs of Django developers in mind. 

You simply point us at your code on Github, and in less than a minute we 
provide you with a public URL of your live running app. We take care of all 
the server setup and management for you, so you can get back to writing 
code!

Sign up for the DjangoZoom beta at http://bit.ly/ezSkKA

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How can I show a list of values in a text input field?

2011-02-07 Thread Nate Reed
Bill, thanks for your reply.  I considered rendering the form
manually, and that would be a fine solution.  I ended up creating a
custom widget (MultiValueTextWidget) that joins the input values.  I
don't know if this is the best solution, but it solves the problem of
rendering the values as a single input field:

class MultiValueTextWidget(TextInput):
def _get_value(self, value):
return " ".join(value)

def _format_value(self, value):
if self.is_localized:
return formats.localize_input(self._get_value(value))
return self._get_value(value)

Overriding __str__ (or was it __unicode__?  I don't have the code in
front of me) results in user-friendly values being rendered instead of
object id's.

My form has a clean method which splits the values and validates them,
and the view handles splitting the input and setting the many-to-many
relation.

I realize this is an unconventional way to render many-to-many
relations in a form, but in this particular case that's how I wanted
to allow the user to see and edit the values.

Thanks,
Nate

On Mon, Feb 7, 2011 at 10:08 AM, Bill Freeman  wrote:
> On Sun, Feb 6, 2011 at 4:25 PM, Nate Reed  wrote:
>> I posted this question on StackOverflow, too.  I have defined a Model
>> with a ManyToManyField, and I want the field to show the values joined
>> by spaces, for example:
>>
>> 
>>
>> I have defined the form to use CharField to represent the multiple values:
>>
>> class MyForm(ModelForm):
>>    foo = CharField(label='Foo')
>>    class Meta:
>>        model = MyModel
>>
>> Instead of showing the values separated by spaces, the input field
>> shows this instead:
>>
>> [u'val1', u'val2', u'val3']
>>
>> How can I override this behavior?  My understanding is that widgets
>> are responsible for rendering the input.  Is there an example of a
>> custom widget that does something like this?
>>
>> Nate
>>
>
> You have a related problem in terms of what you want to have happen
> when the form is submitted.  The string that you get needs to be
> converted to objects (or their id's) before you can save them to the
> DB, and a representation of the id probably isn't what you're expecting
> to show in the field.
>
> CharField is mostly suitable for submitting a character string, typically
> stored in the DB as a character string.  Relation fields are more amenable
> to a (multi-)select field or radio buttons (check boxes for multiple valued
> fields).
>
> You could create a custom form field, if this scheme is truly what you
> wish.
>
> You can also render the desired input within your form by hand, instead
> of expecting the from object's as_p(), etc. to render it for you.  You will
> then also need to check the submitted value in the POST or GET data,
> since the form object doesn't know about it.  The template language is
> strong enough to render what you want if you pass the related object
> manager to the template, but it is a bit hairy for a template, so I'd
> suggest having your view function calculate the desire value string
> for the input, and pass that instead.  When you parse the posted
> value, you will still need to look up the objects somehow from the
> submitted value.
>
> Bill
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How can I show a list of values in a text input field?

2011-02-06 Thread Nate Reed
I posted this question on StackOverflow, too.  I have defined a Model
with a ManyToManyField, and I want the field to show the values joined
by spaces, for example:



I have defined the form to use CharField to represent the multiple values:

class MyForm(ModelForm):
foo = CharField(label='Foo')
class Meta:
model = MyModel

Instead of showing the values separated by spaces, the input field
shows this instead:

[u'val1', u'val2', u'val3']

How can I override this behavior?  My understanding is that widgets
are responsible for rendering the input.  Is there an example of a
custom widget that does something like this?

Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problem loading custom template tag

2010-12-19 Thread Nate Reed
My mistake.  There was a small typo.  It was called __init.py__, not
__init__.py.  I fixed it and it works now.

Thanks,
Nate


On Sun, Dec 19, 2010 at 9:20 PM, Nate Reed  wrote:
> Karen, thanks for your reply.   The module myapp/templatetags does
> have an __init__.py file.  There is no __init__.pyc file, though.
>
> n...@nate-desktop:~/work/django-projects/myproject/myapp$ ls templatetags/
> mytags.py  __init.py__
>
> On Sun, Dec 19, 2010 at 8:59 PM, Karen Tracey  wrote:
>> On Sun, Dec 19, 2010 at 8:40 PM, Nate Reed  wrote:
>>>
>>> When I try to import my module in the shell I also am unable to import it:
>>>
>>> >>> from django.templatetags import mytags
>>> Traceback (most recent call last):
>>>  File "", line 1, in 
>>> ImportError: cannot import name mytags
>>> >>> from myapp.templatetags import mytags
>>> Traceback (most recent call last):
>>>  File "", line 1, in 
>>> ImportError: No module named templatetags
>>>
>>> Does this mean something is wrong with my path or setup?  Any ideas?
>>
>> Looks like the myapp/templatetags directory is missing an __init__.py file.
>> You need this in order for Python to include it in the search for modules on
>> import.
>>
>> (As a side note, the error message that implies only django.templatetags was
>> searched for your custom template tags was misleading and has been improved
>> in newer releases.)
>>
>> Karen
>> --
>> http://tracey.org/kmt/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problem loading custom template tag

2010-12-19 Thread Nate Reed
Karen, thanks for your reply.   The module myapp/templatetags does
have an __init__.py file.  There is no __init__.pyc file, though.

n...@nate-desktop:~/work/django-projects/myproject/myapp$ ls templatetags/
mytags.py  __init.py__

On Sun, Dec 19, 2010 at 8:59 PM, Karen Tracey  wrote:
> On Sun, Dec 19, 2010 at 8:40 PM, Nate Reed  wrote:
>>
>> When I try to import my module in the shell I also am unable to import it:
>>
>> >>> from django.templatetags import mytags
>> Traceback (most recent call last):
>>  File "", line 1, in 
>> ImportError: cannot import name mytags
>> >>> from myapp.templatetags import mytags
>> Traceback (most recent call last):
>>  File "", line 1, in 
>> ImportError: No module named templatetags
>>
>> Does this mean something is wrong with my path or setup?  Any ideas?
>
> Looks like the myapp/templatetags directory is missing an __init__.py file.
> You need this in order for Python to include it in the search for modules on
> import.
>
> (As a side note, the error message that implies only django.templatetags was
> searched for your custom template tags was misleading and has been improved
> in newer releases.)
>
> Karen
> --
> http://tracey.org/kmt/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem loading custom template tag

2010-12-19 Thread Nate Reed
Hi, I'm using Django 1.2.1 and I'm having problems trying to load my
template tags:

{% load mytags %}

TemplateSyntaxError at /myapp/

'mytags' is not a valid tag library: Template library mytags not
found, tried django.templatetags.mytags

It's defined in myproject/myapp/templatetags/mytags.py.

n...@nate-desktop:~/work/django-projects/myproject$ ls myapp/templatetags/
mytags.py  __init.py__
n...@nate-desktop:~/work/django-projects/myproject$ more
myapp/templatetags/mytags.py
from django import template

register = template.Library()

@register.simple_tag
def myclass(request):
return request.path

I added 'myapp' to INSTALLED_APPS, and updated TEMPLATE_LOADERS (as
per a suggestion from StackOverflow):
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
'django.template.loaders.app_directories.load_template_source',
)

When I start the server I see this warning message:

/usr/local/lib/python2.6/dist-packages/django/template/loaders/eggs.py:4:
UserWarning: Module _mysql was already imported from
/usr/lib/pymodules/python2.6/_mysql.so, but
/usr/lib/pymodules/python2.6 is being added to sys.path

When I try to import my module in the shell I also am unable to import it:

>>> from django.templatetags import mytags
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name mytags
>>> from myapp.templatetags import mytags
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named templatetags

Does this mean something is wrong with my path or setup?  Any ideas?

Thanks,
Nate

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help me with render_to_response!

2010-05-26 Thread Nate
def my_root_page(request):
#t = get_template('root.html')
html = 'Please Work!'
#t.render(Context({}))
return HttpResponse(html)

def current_datetime(request):
now = datetime.datetime.now()
return render_to_response('current_datetime.html',
{'current_date': now})

These are the views.  my_root_page displays as desired, but
current_datetime prints out:




The current time


My helpful timestamp site
It is now May 26, 2010, 5:13 p.m..

Thanks for visiting my site.



If you want to see the template I used, its




{% block title %}{% endblock %}


My helpful timestamp site
{% block content %}{% endblock %}
{% block footer %}

Thanks for visiting my site.
{% endblock %}



and

{% extends "base.html" %}
{% block title %}The current time{% endblock %}
{% block content %}
It is now {{ current_date }}.
{% endblock %}

On May 26, 5:05 pm, Daniel Roseman  wrote:
> On May 26, 8:19 pm, Nate  wrote:
>
> > I'm teaching myself django and I'm having an issue with
> > render_to_response.  I am passing it a template and a dictionary.
> > When I view the page on a local host, it displays the entire template,
> > including HTML tags, instead of formatting the page according to the
> > tags.  I don't have this issue when I hard code in the template
> > rendering and use HttpResponse.  Any suggestions would be
> > appreciated.  Thanks!
>
> Show your code, please.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Help me with render_to_response!

2010-05-26 Thread Nate
I'm teaching myself django and I'm having an issue with
render_to_response.  I am passing it a template and a dictionary.
When I view the page on a local host, it displays the entire template,
including HTML tags, instead of formatting the page according to the
tags.  I don't have this issue when I hard code in the template
rendering and use HttpResponse.  Any suggestions would be
appreciated.  Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-admin.py complains about missing DJANGO_SETTINGS_MODULE

2009-07-14 Thread Nate Reed
The admin tool is complaining about this environment variable, but I've
never had this problem before on this box.  I'm not sure what's changed
since the last time I used it.

I tried specifying the path:

$ django-admin.py syncdb --settings=mysite.settings
Error: Could not import settings 'mysite.settings' (Is it on sys.path? Does
it have syntax errors?): No module named mysite.settings

What's the fix for this (short of modifying django-admin.py to add my
project to the python import path)?

I'm using django 1.0 (from SVN).

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with sorl-thumbnail invalid image

2009-03-22 Thread Nate Reed
No, I didn't create the image.  I'm guessing you chose the "Interlaced"
option, or that "Adobe Photoshop PNG" is an interlaced PNG format.  I'm not
that familiar with Photoshop.

On Sun, Mar 22, 2009 at 4:22 PM, DLitgo  wrote:

>
> Nate,
>
> I had a similar problem to this, I'm not sure if its the exact same
> issue, but by any chance did you use Photoshop to create/save the
> image as png? I noticed that by default Photoshop saves the image as
> an "Adobe Photoshop PNG File" as opposed to "Portable Networks Graphic
> Image" file. There's apparently some difference between the two.
> Anyways making sure my image wasn't an *Adobe PNG fixed the problem
> with me.
>
> On Mar 21, 11:18 pm, Nate Reed  wrote:
> > As a workaround I used Gimp to convert this image to a compatible format
> > before uploading it.  Hopefully my users won't mind this limitation.  It
> > does seem a rather glaring omission from PIL, though, doesn't it?
> >
> > Nate
> >
> > On Sat, Mar 21, 2009 at 5:38 PM, Malcolm Tredinnick <
> >
> > malc...@pointy-stick.com> wrote:
> >
> > > On Sat, 2009-03-21 at 17:33 -0700, Nate Reed wrote:
> > > [...]
> > > > Is there some way I can work with interlaced PNG's in PIL?
> >
> > > Typing "PIL interlaced PNG" into Google suggests not. That's one of
> > > those problems that will be fixed by somebody with sufficient
> motivation
> > > to write a patch for PIL, I suspect.
> >
> > > Regards,
> > > Malcolm
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
As a workaround I used Gimp to convert this image to a compatible format
before uploading it.  Hopefully my users won't mind this limitation.  It
does seem a rather glaring omission from PIL, though, doesn't it?

Nate

On Sat, Mar 21, 2009 at 5:38 PM, Malcolm Tredinnick <
malc...@pointy-stick.com> wrote:

>
> On Sat, 2009-03-21 at 17:33 -0700, Nate Reed wrote:
> [...]
> > Is there some way I can work with interlaced PNG's in PIL?
>
> Typing "PIL interlaced PNG" into Google suggests not. That's one of
> those problems that will be fixed by somebody with sufficient motivation
> to write a patch for PIL, I suspect.
>
> Regards,
> Malcolm
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
More info:

>>> im = Image.open('my_logo.png')
>>> outfile = 'my_logo.jpg'
>>> im.save(outfile)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 1272, in save
self.load()
  File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 155, in
load
self.load_prepare()
  File "/usr/lib/python2.4/site-packages/PIL/PngImagePlugin.py", line 337,
in load_prepare
raise IOError("cannot read interlaced PNG files")
IOError: cannot read interlaced PNG files

Is there some way I can work with interlaced PNG's in PIL?

On Sat, Mar 21, 2009 at 5:29 PM, Nate Reed  wrote:

> I have a model that uses sorl-thumbnail.ImageWithThumbnailsField:
>
> class Vendor(models.Model):
> url = models.URLField()
> logo = ImageWithThumbnailsField(
> blank = True,
> null = True,
> upload_to = 'logos',
> thumbnail={'size': (80, 80)}
> )
>
> When I try to create a new Vendor using a particular PNG file (it would
> works for some PNG's but not this one) in my admin interface, I get the
> following error for the 'logo' field:
>
> "Upload a valid image. The file you uploaded was either not an image or a
> corrupted image."
>
> I've verified this image is not corrupted, and it's a valid PNG file.
> Also, the error doesn't seem to be coming from PIL:
>
> >>> import Image
> >>> im = Image.open('my_logo.png')
> >>> print im.format, im.size, im.mode
> PNG (142, 49) P
>
> Here's the format/size/mode for one that works fine with image uploading:
> PNG (420, 420) RGBA
>
> Any ideas?  How can I find where this error is originating?
>
> Nate
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problem with sorl-thumbnail invalid image

2009-03-21 Thread Nate Reed
I have a model that uses sorl-thumbnail.ImageWithThumbnailsField:

class Vendor(models.Model):
url = models.URLField()
logo = ImageWithThumbnailsField(
blank = True,
null = True,
upload_to = 'logos',
thumbnail={'size': (80, 80)}
)

When I try to create a new Vendor using a particular PNG file (it would
works for some PNG's but not this one) in my admin interface, I get the
following error for the 'logo' field:

"Upload a valid image. The file you uploaded was either not an image or a
corrupted image."

I've verified this image is not corrupted, and it's a valid PNG file.  Also,
the error doesn't seem to be coming from PIL:

>>> import Image
>>> im = Image.open('my_logo.png')
>>> print im.format, im.size, im.mode
PNG (142, 49) P

Here's the format/size/mode for one that works fine with image uploading:
PNG (420, 420) RGBA

Any ideas?  How can I find where this error is originating?

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Nate Reed
On Thu, Mar 19, 2009 at 4:29 PM, Alex Gaynor  wrote:

>
>
> On Thu, Mar 19, 2009 at 7:21 PM, Nate Reed  wrote:
>
>> I'm working on an admin interface for my app, and wondering how to
>> customize what gets displayed.
>>
>> Under Home->MyModels->MyModels, MyModel instances are listed as "MyModel
>> object."  When editing another model, the foreign key reference to MyModel
>> gets displayed as a list of:
>>
>> MyModel object
>> MyModel object
>> ....
>> etc
>>
>> I'd like it to make it show MyModel.name instead.  How is this changed?
>>
>> Nate
>>
>>
>>
> Using the __unicode__ method on models.  If you read through the tutorial
> you'll see how this works.
>
> Alex
>

Thanks.

There's no mention of it in the section on the admin site.  Is __unicode__
used for anything else?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Nate Reed
I'm working on an admin interface for my app, and wondering how to customize
what gets displayed.

Under Home->MyModels->MyModels, MyModel instances are listed as "MyModel
object."  When editing another model, the foreign key reference to MyModel
gets displayed as a list of:

MyModel object
MyModel object

etc

I'd like it to make it show MyModel.name instead.  How is this changed?

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Previous form in form wizard

2009-03-05 Thread Nate Soares
Is there an easy way to add a "previous step" button to a form wizard page?

Thanks,

-Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Can QuerySet methods combine filters with an "OR" conjunction?

2009-02-21 Thread Nate Morse

Before I go down the road of writing SQL by hand or using
QuerySet.extra(...) [ don't know much about that yet:], I thought I
would ask if there is a way to achieve (within the QuerySet methods)
something like
...WHERE field_a = 'abc' OR field_b = '123' ...?

It seems if I do:
rs = mymodel.filter(field_a = 'abc', field_b = '123')

it produces an AND conjunction (fine in most cases, but I would like
"OR" instead).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



need to override validation logic

2008-12-03 Thread Nate

I have a form that requires more complex validation logic than is
provided through the default form.is_valid implementation.

As an example, I have a form with properties A and B.  One of A or B
must be set.  If neither is set, a validation error should be raised.
Can someone show me an example of overriding is_valid()?  Ideally, I
would want the validation error associated not with an individual form
field, but with the entire form.

Also, this kind of "business logic" probably belongs in the model
itself.  Judging from previous threads, it looks like model validation
is a work in progress.  Is it ready in 1.0?  What is the suggested
approach for what I want to accomplish?

Thanks,
Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many-To-Many with extra fields

2008-09-23 Thread Nate Thelen

Yeah, that would work, too.  I was thinking more like if you got the
ringo like this:

ringo = Person.objects.select_related(depth=2).get(name='ringo')

how could you get the data without having to make another DB call.

Ideas?

Thanks,
Nate

On Sep 23, 2:04 pm, akonsu <[EMAIL PROTECTED]> wrote:
> hello,
>
> how about
>
> for m in Membership.objects.filter(person=ringo) : print m.date_joined
>
> konstantin
>
> On Sep 23, 4:58 pm, Nate Thelen <[EMAIL PROTECTED]> wrote:
>
> > So if I have a Person object "ringo" and I want to get info about the
> > Groups he is a member of, I would do this:
>
> > for group in ringo.group_set.all()
> >     print( group.name )
>
> > My question is, how do I print the "date_joined" without having to do
> > this:
>
> > for group in ringo.group_set.all()
> >     print( Membership.objects.get(person=ringo,
> > group=group).date_joined )
>
> > That seems very DB inefficient.
>
> > Nate
>
> > On Sep 19, 9:43 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Sat, Sep 20, 2008 at 8:37 AM, Nate Thelen <[EMAIL PROTECTED]> wrote:
>
> > > > Looking at the docs here:
>
> > > >http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-o...
>
> > > > I cannot find any reference to how to access the data in the
> > > > "Membership" table.  For example, if I have a reference to the
> > > > "beatles" object, how do I find the "date_joined" for each of the
> > > > "Person" objects.  I have looked through the other sections of the
> > > > documentation, searched this group, and searched via Google, but
> > > > couldn't find the info.
>
> > > Short version: You access the membership table using the foreign key
> > > relationship that the membership defines.
>
> > > Long version: Your question ("the date_joined for each person object")
> > > is actually ill posed - a person doesn't have a date_joined without a
> > > group to also give context. "The date person X joined group Y" can be
> > > answered as:
>
> > > >>> Membership.objects.get(person=X, group=y).date_joined
>
> > > It might help to think about it like this - m2m-intermediate tables
> > > don't add extra data to an m2m relation, they make a 2-step foreign
> > > key relation behave like an m2m relation.
>
> > > Yours,
> > > Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many-To-Many with extra fields

2008-09-23 Thread Nate Thelen

So if I have a Person object "ringo" and I want to get info about the
Groups he is a member of, I would do this:

for group in ringo.group_set.all()
print( group.name )

My question is, how do I print the "date_joined" without having to do
this:

for group in ringo.group_set.all()
print( Membership.objects.get(person=ringo,
group=group).date_joined )

That seems very DB inefficient.

Nate


On Sep 19, 9:43 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Sat, Sep 20, 2008 at 8:37 AM, Nate Thelen <[EMAIL PROTECTED]> wrote:
>
> > Looking at the docs here:
>
> >http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-o...
>
> > I cannot find any reference to how to access the data in the
> > "Membership" table.  For example, if I have a reference to the
> > "beatles" object, how do I find the "date_joined" for each of the
> > "Person" objects.  I have looked through the other sections of the
> > documentation, searched this group, and searched via Google, but
> > couldn't find the info.
>
> Short version: You access the membership table using the foreign key
> relationship that the membership defines.
>
> Long version: Your question ("the date_joined for each person object")
> is actually ill posed - a person doesn't have a date_joined without a
> group to also give context. "The date person X joined group Y" can be
> answered as:
>
> >>> Membership.objects.get(person=X, group=y).date_joined
>
> It might help to think about it like this - m2m-intermediate tables
> don't add extra data to an m2m relation, they make a 2-step foreign
> key relation behave like an m2m relation.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Many-To-Many with extra fields

2008-09-19 Thread Nate Thelen

Looking at the docs here:

http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

I cannot find any reference to how to access the data in the
"Membership" table.  For example, if I have a reference to the
"beatles" object, how do I find the "date_joined" for each of the
"Person" objects.  I have looked through the other sections of the
documentation, searched this group, and searched via Google, but
couldn't find the info.

Thanks,
Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



OneToOneField value not selected in default html form

2008-09-10 Thread nate

Hi,

The values of OneToOneFields don't appear to remain selected after
creation or update in default forms (such as those used by the admin
interface). I Looked for a bug report but didnt see one. Has anyone
else run into this?

Take the following set of models:

class Thing1(models.Model):
name = models.CharField(max_length=20)

class Thing2(models.Model):
name = models.CharField(max_length=20)

class OTOTest(models.Model):
other = models.OneToOneField('Thing1')

class FKTest(models.Model):
other = models.ForeignKey('Thing2')


---

Now, creating an OTOTest with a Thing1, and clicking save and continue
editing, will present a form with "-" selected (not the Thing1
that you just set).

Another test:

from hosts.models import *
from django.forms import ModelForm, model_to_dict

t1 = Thing1.objects.create(name='thing1')
oto = OTOTest.objects.create(other=t1)
class OTOTestForm(ModelForm):
  class Meta:
model = OTOTest

oto_form = OTOTestForm(instance=oto)
unicode(oto_form)

u'Other:\n-\nThing1
object\n'

(note selected is on the  option)

t2 = Thing2.objects.create(name='thing2')
fk = FKTest.objects.create(other=t2)
class FKTestForm(ModelForm):
  class Meta:
model = FKTest

fk_form = FKTestForm(instance=fk)
unicode(fk_form)

u'Other:\n-
\nThing2 object\n'

(note selected is on the Thing2 object, as expected)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Protecting static files

2008-04-17 Thread Nate

Hi all,
I've been googling for days and haven't really found a good solution
to my problem.

I am building a site where a user can view photos and then choose
which of the photos they want to purchase. (Weddings/parties/HS
graduation etc...) My client doesn't want other users of the site to
be able to access another user's event photos.
So far the only way I can think to truly secure photos from another
user is to serve the image up through Django, but the website says
it's inefficient and insecure. Honestly, the inefficiency, I can
probably deal with as this site will be for a local photographer who
probably won't be getting millions of hits per day, but the insecurity
is what I'm worried about.

I read django's way of protecting static files, but that only limits
it to a group of people and not an individual.

Can anyone help me?

Thanks!

-Nate
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Deployment Headache (Apache Permissions?)

2007-06-06 Thread Nate Straz

On Wed, Jun 06, 2007 at 10:41:15PM -, ATLBeer wrote:
> TheBest.xappx: No module named xappx.models
> 
> > > > > [EMAIL PROTECTED] TheBest]# ls -al
> > > > > drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 .
> > > > > drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> > > > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:35 CRON
> > > > > -rwxr-xr-x 1 thebest bestx   82 Jun  6 15:31 ._.DS_Store
> > > > > -rwxr-xr-x 1 thebest bestx 6148 Jun  6 15:30 .DS_Store
> > > > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> > > > > -rwxr-xr-x 1 thebest bestx0 May 25 12:25 __init__.py
> > > > > -rwxr-xr-x 1 thebest bestx  141 May 29 17:48 __init__.pyc
> > > > > -rwxr-xr-x 1 thebest bestx  546 May 25 12:25 manage.py
> > > > > drwxr-xr-x 2 thebest bestx 4096 May 30 13:55 media
> > > > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp
> > > > > drwxr-xr-x 2 thebest bestx 4096 Jun  6 15:30 xapp

I see three xapp directories in this one, that doesn't seem right.  I
didn't see any xappx directories.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: migrating 400 images

2007-05-07 Thread Nate Straz

On Mon, May 07, 2007 at 05:14:16PM -, Milan Andric wrote:
> Wow, interact() is very cool.  Now I just need to find write one that
> does a similar thing with html body and the local img srcs recursively
> on files within a directory.  Is there a library that parses html
> pages, I'm sure there is, but one that you recommend?

There is one in the Python Standard Library[1], but I haven't used it.
Perhaps someone else on the list has.

Nate

[1] http://docs.python.org/lib/module-HTMLParser.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: migrating 400 images

2007-05-05 Thread Nate Straz

On Fri, May 04, 2007 at 11:13:36PM -, Milan Andric wrote:
> I'm migrating a tutorials site to Django and have created a file model
> that is associated with tutorial pages, etc.  Now I need to go through
> and migrate all the old content.  Rather than upload 400 images I was
> hoping to write a script to call the File.save() method appropriately
> and just copy the images into the new location.
> 
> Any thoughts on how to approach this?  Do you think this will likely
> take more time than just doing it by hand?

When I was migrating my site from Zope to Django I added a migrate.py
module to the app I was migrating to.  In there I wrote a function to do
the migration.  I would run it like this:

# python manage.py shell
>>> from blog.migrate import loadCOREBlog

In loadCOREBlog I loaded all of the Zope libraries and started iterating
through whatever needed to be migrated.  When I detected a problem I
would use Python's code.interact function to get a shell at that point
in my script to help deal with any unexpected migration issues.

http://refried.org/viewvc/viewvc.py/refriedorg/blog/migrate.py?view=markup

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Navigating the Documentation

2007-04-17 Thread Nate Finch

Hi, thanks for the very reasoned, and thorough response to a somewhat
bitchy post.  My apologies, I was tired and frustrated, so the email
came off a bit more edgy than I really intended.

Those links do help a lot.  I'll try to gather my thoughts into a more
constructive suggestion.  I guess the thing I'd like to see is a
complete tree view of all documentation pages.

Anyway, thanks again.

-Nate

On Apr 16, 8:13 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 4/17/07, Nate Finch <[EMAIL PROTECTED]> wrote:
>
>
>
> > No breadcrumbs so you can go up in the document heirarchy, just a link
> > to the root documentation page
>
> Breadcrumbs for the docs page are a reasonable request. Open a ticket
> and request them.
>
> > If you go to the root, you'll notice there's no link to this generic
> > relations page.
>
> Intentionally. Generic relations aren't _quite_ ready for prime time.
> We provide an example so those that really want to know how they work
> can get a head start, but there won't be a link on the main page until
> we finish the implementation (including Admin support), and write full
> documentation.
>
> > The generic relations page is numbered as #34.  I have no idea what
> > that means, since I can't seem to find a numbered list of pages
> > anywhere.
>
> The numbered list is here:
>
> http://djangoproject.com/documentation/models/
>
> Which is, in turn, linked as 'Reference:Model:Examples" on
>
> http://djangoproject.com/documentation/
>
> > Am I missing some really obvious main page that gives a better
> > starting point for finding information in the docs?  Even just a flat
> > listing of links to each documentation page and a short description of
> > what it contains would be a godsend.
>
> I'm unclear as to what exactly you feel is missing from:
>
> http://djangoproject.com/documentation/
>
> If you have some specific suggestions, put together a draft of what
> you think would be better content for this page, open a ticket, and
> attach your draft.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Navigating the Documentation

2007-04-16 Thread Nate Finch

Am I the only one who has a hellish time trying to navigate Django's
online documentation? (here: http://www.djangoproject.com/documentation/)

There seems to be no good table of contents for what is in the
documentation, and no good way to navigate once you hit a specific
page.

For example, the page on generic relations:
http://www.djangoproject.com/documentation/models/generic_relations/

No breadcrumbs so you can go up in the document heirarchy, just a link
to the root documentation page

If you go to the root, you'll notice there's no link to this generic
relations page.

The generic relations page is numbered as #34.  I have no idea what
that means, since I can't seem to find a numbered list of pages
anywhere.


Am I missing some really obvious main page that gives a better
starting point for finding information in the docs?  Even just a flat
listing of links to each documentation page and a short description of
what it contains would be a godsend.

-Nate


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where does the old manipulator go?

2007-01-04 Thread Nate Straz


On Thu, Jan 04, 2007 at 07:59:10PM +0530, Ramdas S wrote:

I am trying to move a user registration form code inspired heavily from
http://www.b-list.org/weblog/2006/09/02/django-tips-user-registration
to newforms from oldforms.

Does the newforms replace django.core.manipulators, if so how can I use it?


Yes it does.  I just converted my comments app[1] from oldforms to
newforms.  You might find it useful to look at the diff.

http://refried.org/viewvc/viewvc.py?view=rev&revision=150

Nate

[1] It's a direct copy of freecomments hacked to make my migration from
COREBlog easier.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Diamanda Wiki and MyghtyBoard Forum on SVN now

2006-09-08 Thread Nate Straz

On Thu, Sep 07, 2006 at 11:36:46PM +0800, limodou wrote:
> On 9/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > I don't want to make another mediawiki which requires to learn yet
> > another markup language and needs a horde of wikipedians to controll
> > it. 
>
> So which text format do you think is the most familiar with people? I
> think wiki format should be.

I use reStructuredText_ quite a bit.  I find it very easy to work with
and it's part of the docutils_ package.

Nate_ :)

.. _reStructuredText: http://docutils.sf.net/rst.html
.. _docutils: http://docutils.sf.net/
.. _Nate: http://refried.org/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Creating graphs in Django application

2006-09-07 Thread Nate Straz

On Thu, Sep 07, 2006 at 01:39:30AM -0700, Devraj wrote:
> I am attempting to create graphs in my Django app.to provide reporting
> features. Are there any libraries available to do this in Python or
> Django?

PyX, http://pyx.sourceforge.net/

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: get_next_by_FIELD and alternate managers

2006-09-03 Thread Nate Straz

On Sun, Sep 03, 2006 at 11:26:22PM +0100, Konstantin Shaposhnikov wrote:
> On 9/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > My problem is that my older/newer navigation that uses
> > entry.get_next_by_pub_date also picks up unpublished entries.  Is there
> > a way to tell get_next_by_pub_date to use the manager "published"
> > instead of "objects?"
>
> You can pass additional filter arguments to get_next_by_pub_date
> method like this:
> entry.get_next_by_pub_date(is_published = True)

Is there a way to do this inside a template?

I ended up defining new functions on the Entry model to keep calling
get_next_by_pub_date until it got to a published entry.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



get_next_by_FIELD and alternate managers

2006-09-03 Thread nate-django

In my blog I take advantage of get_next_by_FIELD (pub_date in this case)
for navigation to older and newer stories in my entry detail view.  I
also have a flag in my entry model that says whether or not a blog entry
is published.  I defined an alternate manager called "published" to make
it easier to pick out only published entries.

My problem is that my older/newer navigation that uses
entry.get_next_by_pub_date also picks up unpublished entries.  Is there
a way to tell get_next_by_pub_date to use the manager "published"
instead of "objects?"

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Advanced Admin Customization

2006-09-01 Thread nate-django

On Fri, Sep 01, 2006 at 10:21:38AM -0700, mthorley wrote:
> Table creation is handled by core.management. In it, a lookup is
> preformed where it loads the dict DATA_TYPES (or something like that)
> from db.backends..creation. Then it attempts a key matching the
> field class name of each field in your model. So in order to create
> your own fields, whether you subclass an existing one or not, you must
> either overwrite the class name, or add your fieldtype to the list.

This thread has peaked my interest so I did some code digging.  I was
thinking that overriding the class name didn't seem like a smart choice.
I thought it would be nice if the creation code would check the parent
class's name if it couldn't find the current class name in DATA_TYPES.

Upon inspection of the code I found it was calling get_internal_type()
for each field.  If you look in db/models/fields/__init__.py you'll
find that this is used in EmailField which subclasses CharField.

class EmailField(CharField):
...
def get_internal_type(self):
return "CharField"

Now I'll have to try creating some custom fields myself. :)

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: My blog is now Django -- source is available

2006-08-22 Thread nate-django

On Tue, Aug 22, 2006 at 06:20:14AM -0700, Tim Shaffer wrote:
> It looks like some of your views are very simple and could use generic
> views, if you wanted.
> 
> def home(request):
>   return render_to_response('home.html')
> 
> could use django.views.generic.simple.direct_to_template

I was leaving room for making that a more complex view later, but I may
never get to that.

> def entry(request, entry_id):
>   e = get_object_or_404(Entry, pk=entry_id)
>   return render_to_response('blog/entry.html', { 'entry': e })
> 
> could use django.views.generic.list_detail.object_detail

I do.  I probably can remove all of those views.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



My blog is now Django -- source is available

2006-08-22 Thread nate-django

Since so many people are developing their own blogs in Django, I thought
it would be good to announce that the source code to mine is now
available.  Mine is probably of most interest to people migrating from
COREBlog or other Zope blogging software.

Browse: http://refried.org/viewvc/viewvc.py/refriedorg
svn co http://refried.org/svn/refriedorg

My implementation is a very simple, multi-user blog.  The most important
feature to me was a complete migration from COREBlog.  I was able to
import all of my COREBlog entries, with images and comments.

My to do list includes:
 - style the comment form
 - More blog centric admin interface
  - show unapproved comments
  - Make retagging entries easy
  - Ability to preview the entry while editting
 - Photo manager and gallery

Nate

P.S. I also have Jacob's sudoku app ported to magic-removal in there.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Django covered in podcast with Guido

2006-08-07 Thread nate-django

On Mon, Aug 07, 2006 at 12:46:57AM -0700, Dan Shafer wrote:
> On 8/6/06, Alan Green <[EMAIL PROTECTED]> wrote:
> > On 8/5/06, Simon Willison <[EMAIL PROTECTED]> wrote:
> > > http://www.twit.tv/floss11
> > >
> > > Django gets some good discussion about 50 minutes in.
> >
> > Guido sure says nice things about Django. Congratulations!
>
> I'd say! I mean he calls it his favorite Web app framework and declares
> himself a satisfied user.

He said he used parts of it.  He was impressed with the speed of the
templating system and made reference to the article on Django's speed vs
RoR.  I was pleased that he accurately recalled how Django got started.

It was a great podcast.  I recommend listening to it if you haven't
already.  There were some interesting insights on Python design, past
and future.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: when is 1 != 1? (according to 'ifequal' in template)

2006-08-07 Thread nate-django

On Mon, Aug 07, 2006 at 06:07:24PM -, hotani wrote:
> I'm doing a comparison of a session variable and an id for a 'selected'
> tag in a drop-down in a template. If I output both vars, they will both
> be "1" yet 'ifequal' is still returning false. Has water stopped being
> wet?

Is one a string and the other an integer?

Python 2.4.2 (#1, Feb 12 2006, 03:45:41) 
[GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1
>>> b = '1'
>>> a
1
>>> b
'1'
>>> a == b
False
>>> a != b
True


Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Managing database privileges

2006-07-05 Thread nate-django

On Tue, Jul 04, 2006 at 11:23:16PM -0300, Douglas Campos wrote:
> you can specify what user/password to connect to database in
> settings.py file, under your project dir
> 
> http://www.djangoproject.com/documentation/tutorial1/#database-setup

True, but that's not what I was asking.

> On 7/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > How do people manage the user and privilege aspect of a Django
> > deployment?  Do you all access that database with the same user as
> > created the database?  Do you grant access to each table that the web
> > server needs to query?

So does your database only have one user created and you specify that in
the settings file or whenever you want to inspect the database by hand?

I'm under the impression that having a separate database user for the
web server and the developer is the Right Thing To Do(tm).
Unfortunately I don't find anything in the documentation, wiki, or
archives to support that idea.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Managing database privileges

2006-07-04 Thread nate-django

I am in the process of moving my Django project from using the
development server to Apache and mod_python.  I created the PostgreSQL
databases as myself and ran the development server as myself.  Now that
I'm getting stuff going with mod_python, it'll start running as user
"www-data" under Apache.  I would like to allow "www-data" to access my
development database while I verify everything works.  I've found that I
have to grant access to every table that Django wants to query.

How do people manage the user and privilege aspect of a Django
deployment?  Do you all access that database with the same user as
created the database?  Do you grant access to each table that the web
server needs to query?

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Wiki or Blogs done with django

2006-05-29 Thread nate-django

On Mon, May 29, 2006 at 09:48:11AM +0200, Giovanni Giorgi wrote:
>  I am planning to build a small personal web site.
> I have used Plone CMS (Zope powered) but it is very slow and requires
> a lot of memory.

I'm coming from a similar camp.  I've had a blog running on Zope with
COREBlog for about a year and a half.  I want to be able to move all of
my content over without losing anything.

The good news is that I've gotten most of the way.  The bad news is that
I still haven't switched over.  I currently have a weblog implementation
modelled after the COREBlog metadata.  I have a migration tool that I
run via the Django shell.  It converts all of my entries and comments.

I'm hung up on a few things.

1. Photo handling

  I have quite a few dozen entries with photos (out of 100+) and I want
  to add lots more.  I currently crop the images down to an acceptable
  size and include them inline to the story.  I would like to have some
  more advanced way of handling images so visitors can get full size
  images easily, so I can put up film-strips and slide shows.

2. Comments

  I like the ideas behind the comments API the ships with Django, but
  the metadata collected doesn't match up with what COREBlog was using.
  I started creating a new comments API that is a blend of Django and
  COREBlog, but I keep getting stuck and procrastinating.  What has me
  hung up at the moment is that I want to store the IP address of the
  commentor.  I don't want it edittable, but I want it displayed in the
  admin interface.

I started hacking on this pre-magic removal and I have since removed
most of the magic from my code.  I always admired Zope, but Django seems
a lot easier to get a long with.  

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: hack for file-browser

2006-05-02 Thread nate-django

On Tue, May 02, 2006 at 02:47:33PM +0200, va:patrick.kranzlmueller wrote:
> i?m working on a file-browser for/with the django-admin.
> screenshots are here:
> http://www.vonautomatisch.at/django/ftp/

Wow, that looks great!  I would love to use that in my apps.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Manipulators and non-editable fields

2006-04-21 Thread nate-django

Perhaps I'm going about this the wrong way...

I'm trying to validate fields for a comments app I'm working on.  As
part of the model I have a few non-editable fields, IP address and date.
Can non-editable fields be validated or even saved when using a
manipulator?

Here is the code I'm working with ATM.  It is part of the post_comment view.

manipulator = comments.AddManipulator()
new_data = request.POST.copy()
new_data['object_id'] = object_id
new_data['content_type'] = content_type_id
new_data['date'] = datetime.datetime.now()
new_data['ipaddr'] = request.META.get('REMOTE_ADDR')
#manipulator.do_html2python(new_data)
nc = manipulator.save(new_data)

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: ImageField nightmares

2006-03-25 Thread nate-django

On Sat, Mar 25, 2006 at 07:35:46AM -0800, sparkydeville wrote:
> To clarify the use-case, consider an article like an image gallery,
> wherein one article can have more than one image associated with it.
> Further it would be helpful if the Article add/edit form could allow
> users to add images while adding / editing articles.

How are the images integrated into the articles?

This is something I'm working on for my blog implementation.  My current
design has a model Entry to hold blog entries and a model Attachment so
I can attach images to an Entry.

class Entry(meta.Model):
title = meta.CharField(maxlength=100)
subtitle = meta.CharField(maxlength=100, blank=True)
pub_date = meta.DateTimeField('date published')
author = meta.ForeignKey(User)
status = meta.CharField(maxlength=32, 
choices=STATUS_CHOICES, 
default='Draft',
radio_admin=True)
tags = meta.ManyToManyField(Tag)
body = meta.TextField()
format = meta.PositiveIntegerField(choices=FORMAT_CHOICES, 
default=4,
radio_admin=True)

class Attachment(meta.Model):
entry = meta.ForeignKey(Entry, edit_inline=meta.TABULAR, num_in_admin=2)
url = meta.CharField('URL', maxlength=200, core=True)
file = meta.FileField('Attachment', upload_to='attachments')

To display the attachments in an Entry I reference the URL of the
attachment in the body of the entry.  This worked for me on the detail
page of the entry, but not a list of entries.  :(

After looking around the 'Net for ways people are referencing images in
blogs and articles, it appears that everyone just dumps all of their
images into one directory.  This doesn't feel very clean to me, but I
might have to give in.

I haven't had any problems with the data base and the FileField I'm
using.  I see problems with the error handling in the edit_inline
templates.  It seems that the field groups were recently wrapped and now
the templates can't find the error messages for edit_inline fields
anymore.  Yeah, I should file a bug on it. ;)

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Advice on developing with django for a team of 10+

2006-03-24 Thread nate-django

On Thu, Mar 23, 2006 at 09:23:30AM -0800, tonemcd wrote:
> Oooh, now that's neat. My own tinkering with svn to ignore .pyc files
> hasn't worked out so well...

The way I did it was to edit my ~/.subversion/config file.  There is a
section, "[miscellany]" that includes a "global-ignores" option.  Just
add "*.pyc" to this space separated list.

Unfortunately this is a per-user solution, but you could add this to the
user skeleton or just tell everyone to adjust this setting.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: mod_python & devserver & apache restart

2006-02-21 Thread nate-django

On Tue, Feb 21, 2006 at 08:12:30PM +0100, patrick k wrote:
> 1. is the django development-server only meant for local use? i?m asking
> because i tried to use it with dreamhost and it doesn?t seem to work.

You need to specify the hostname and port with runserver.

i.e. python manage.py runserver hostname:port

It defaults to 127.0.0.1.

Nate

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Modelling Help

2005-08-15 Thread Nate Drake

Adrian,

Thanks a lot!  I appreciate the fast response.  One other question.  Is
there a way to make the admin app render a text field as a password
field?

Thanks again!

Nate



Modelling Help

2005-08-15 Thread Nate Drake

Hi there,

I'm not sure if the is the best place to ask, but I have some questions
about how to best define my model in Django.  I'm still fairly new to
Python and really new to Django, so if you see that I've done something
stupid, feel free to correct me.

I'm trying to build a simple (American) football pool app.  I've
included my current model at the end of my post.  It is currently VERY
simple, as I was just messing around getting a feel for Django.  The
questions I have mostly relate to the relations between games, game
results, teams.

1) What is the "best" way to define the relationship between one Game
and the two Teams that are playing the game?
2) When I use the admin interface to create a new "Game Result", it
displays two drop-downs for selecting teams.  It currently lists all
the teams in the DB.  Is there a way to restrict the items in the
drop-down to only include the two teams that played in that specific
game?
3) When creating a new Game via the admin interface, the drop-downs for
the two teams are both labeled "Team".  Is there a way to change the
labels to "Home Team" and "Away Team"?

Thanks for any advice you can give!

Nate

--

from django.core import meta

# Create your models here.
class User(meta.Model):
fields = (
meta.CharField('username', maxlength=20),
meta.CharField('password', maxlength=10),
)
admin = meta.Admin()
def __repr__(self):
return self.username

class Team(meta.Model):
fields = (
meta.CharField('name', maxlength=25),
meta.CharField('city', maxlength=25),
)
admin = meta.Admin()
def __repr__(self):
return self.city + " " + self.name

class Game(meta.Model):
fields = (
meta.DateTimeField('date'),
meta.ForeignKey(Team, name="home_team_id",
rel_name="home_team",
related_name="home_team"),
meta.ForeignKey(Team, name="away_team_id",
rel_name="away_team",
related_name="away_team"),
)

admin = meta.Admin()

def __repr__(self):
return self.get_away_team().name + " at " +
self.get_home_team().name + " ("+self.date.strftime('%m/%d/%Y @ %H:%M')
+ ")"


class GameResult(meta.Model):
fields = (
meta.OneToOneField(Game),
meta.IntegerField('winning_score',blank=True),
meta.IntegerField('losing_score',blank=True),
meta.ForeignKey(Team, name="winning_team_id",
rel_name="winning_team",
related_name="winning_team"),
meta.ForeignKey(Team, name="losing_team_id",
rel_name="losing_team",
related_name="losing_team"),
)
admin = meta.Admin()
def __repr__(self):
return `self.winning_team_id` + " (" + `self.winning_score` +
")/" + `self.losing_team_id` + " (" + `self.losing_score` + ")"


class Pick(meta.Model):
fields = (
meta.ForeignKey(User),
meta.ForeignKey(Game),
meta.ForeignKey(Team, rel_name='winner'),
meta.IntegerField('points')
)
admin = meta.Admin()
def __repr__(self):
return "Picks for: " + self.get_user().username