Automatically loading data into Django

2010-09-07 Thread Duane Hilton
Hello,

I'm trying to automatically update a Django project using json
fixtures. ... There is a pipe delimited file that is automatically
updated. I would like to save the data from that file into a Django
project. The way I have been approaching this is to convert the file
into json fixtures and use manage.py loaddata to get the data into the
Django project. Is there a better way?

Also, I would like to be able to show when a record was last updated.
I know this is easy to do if you are using the admin site to input
information (as shown in Practical Django Projects), but I haven't
seen a way to do it using loaddata. How do you show when a record was
updated if you're not using the admin site?

Thanks in advance for any responses.

-- 
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: Automatically loading data into Django

2010-09-07 Thread Duane Hilton
Thanks for the response. I think that is exactly what I'm looking for.
But, being a newb, this raises new questions that I will spare the
group. Could you point me toward a book or tutorial that would show me
how to do that?

Thanks.

On Tue, Sep 7, 2010 at 10:23 AM, Shawn Milochik  wrote:
> It doesn't seem like converting your data into fixtures will provide
> any advantage. If it's pipe-delimited, then just write a Python script
> imports the CSV module (which can handle other delimiters) and your
> model(s).
>
> Use it to read the data and convert it to dictionaries, then create
> instances of your models, populate them, and save them.
>
> Shawn
>

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



Custom validation in model formset

2010-10-11 Thread Duane Hilton
Hi all,

I'm trying to do some custom validation on a model formset, but I'm
not having good luck. Thank you in advance for your suggestions ...

In my views, I have:

class BaseCandFormSet(BaseModelFormSet):
def clean(self):
super(BaseCandFormSet, self).clean()
for form in self.forms:
x = form['x_field']
y = form['y_field']
if y < x:
raise forms.ValidationError('Y cannot be less than x.')

I get the following error:

Exception Value: 'list' object has no attribute 'ValidationError'

-- 
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: Custom validation in model formset

2010-10-11 Thread Duane Hilton
Changing forms to form brings a new error:

*Exception Value: 'CandidateFeedForm' object has no attribute
'ValidationError'*

Below is the view that is using the BaseCandFormSet code that I included in
the original message. Maybe something is wrong in it? Thanks in advance for
your suggestions. I've spent a few days using the documentation and trying
to get this to work. I really appreciate the help. ...

*def state_office(request):
CandFormSet = modelformset_factory(CandidateFeed,
**queryset=CandidateFeed.objects.all().order_by('last_name',
'county'),** formset=BaseCandFormSet, extra=0)
if request.method == 'POST':
formset = CandFormSet(request.POST, request.FILES)
if formset.is_valid():
formset.save()
return HttpResponseRedirect('/foo/bar/')
else:
formset =
CandFormSet(queryset=CandidateFeed.objects.all().order_by('last_name',
'county'))
return render_to_response('state_office.html', { 'formset': formset })*

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



[no subject]

2011-11-21 Thread Duane Hilton
http://bookobrothers.com/modules/mod_wdbanners/site.php?html138

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



Encrypted Fields

2017-07-06 Thread Duane Hilton
I'm looking at using EncryptedCharField in django-extensions. It
uses Keyczar, which I've read is not compatible with Python 3 (
https://stackoverflow.com/questions/37234111/encrypt-django-model-field-using-python-3-5).
My question is: Can Keyczar and EncryptedCharField be used with Python 3?

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


Re: Django Channels: best way to launch multiple workers

2024-08-09 Thread Duane Hilton
Is there any update on this? Do we have any recommendations now on how many
workers can run on a server?

On Tue, Oct 10, 2017 at 5:00 AM Andrew Godwin  wrote:

> I don't have enough hard data to give a recommendation, unfortunately.
>
> Andrew
>
> On Mon, Oct 9, 2017 at 7:14 PM, Piet van Leeuwen 
> wrote:
>
>> On a server is there a recommendation for how many workers to have
>> running?
>>
>> With Gunicorn we would run...
>>
>> def max_workers():
>> return cpu_count() * 2 + 1
>>
>>
>>
>>
>> On Thursday, February 9, 2017 at 11:38:07 AM UTC+13, Andrew Godwin wrote:
>>>
>>> The difference is mostly in Python performance - threading in Python
>>> tends to perform worse than using multiple processes, which is why we
>>> recommend using multiple processes in the docs. However, you can save a bit
>>> of memory usage with threading, so you can use that if you want.
>>>
>>> I would not, however, recommend running more than 2 - 4 threads per
>>> process, as otherwise you'll likely see performance take a slide due to the
>>> GIL.
>>>
>>> Andrew
>>>
>>> On Wed, Feb 8, 2017 at 11:53 AM, Charlie DeTar  wrote:
>>>
 What's the best way to launch multiple Django channels workers on a
 production server to take advantage of extra cores?

 The documentation says
 
 :

 Each server is single-threaded, so it’s recommended you run around one
> or two per core on each machine; it’s safe to run as many concurrent
> workers on the same machine as you like, as they don’t open any ports (all
> they do is talk to the channel backend).


 However, `python manage.py help runworker` lists a "--threads" option,
 which seems to imply that a single invocation of runworker can launch
 multiple workers.

 Is there a functional difference between `./manage.py runworker
 --threads 4` and launching `./manage.py runworker` process 4 times?

 best,
 Charlie

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/8097b8f7-3f89-49a6-b189-58a0713972ef%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

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

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