Re: Office365/SharePoint Online Integration

2017-12-15 Thread Erik Cederstrand
> Den 15. dec. 2017 kl. 22.18 skrev Alexander Joseph > : > > I'm still new to django but I'm building an app that allows users to > authenticate through Office365. I'm using this - > https://github.com/Lamelos/django-allauth-office365 > and I got users to be able

Re: transferring data between Postgres databases

2016-10-24 Thread Erik Cederstrand
> Den 24. okt. 2016 kl. 06.04 skrev Mike Dewhirst : > > I have a user who has done a lot of work (instead of playing) in the staging > server and now wants to get that work into the production database. > > I'm about to research selective dump and load capabilities of

Re: Sharding DB: one database per user dynamically

2016-10-06 Thread Erik Cederstrand
> Den 6. okt. 2016 kl. 15.34 skrev Stefano Tranquillini > : > > Well, not really. > > I would like to shard the db, but probably i can just build a function to > write on DB1 or DB2 depending on the user id, this should be feasible, isn't > it? Yes, that

Re: Sharding DB: one database per user dynamically

2016-10-06 Thread Erik Cederstrand
> Den 6. okt. 2016 kl. 09.54 skrev Stefano Tranquillini > : > > Hi all, > > I quickly skimmed into the group but i did not find an updated answer. > > what i want to do is to have a database for each user that register to my > service, the structure of the

Re: covert julian date to calander date

2016-09-21 Thread Erik Cederstrand
> Den 21. sep. 2016 kl. 02.41 skrev sum abiut : > > Thanks Erik, > > i think that should do the trick.is there a way to covert the date column > straight from the sql query or from the template? If you want to do this from the template, create a custom template tag:

Re: covert julian date to calander date

2016-09-20 Thread Erik Cederstrand
> Den 20. sep. 2016 kl. 01.40 skrev sum abiut : > > Hi, > how to you convert from Julian date to a Calender date. I am pulling data > from an MSSQL and i what to convert the Julian date to calender date before > displaying data on my template. If I understand your question

Re: Django exit function

2016-09-14 Thread Erik Cederstrand
> Den 14. sep. 2016 kl. 23.00 skrev Krešimir : > > Thank you, dear Sir! > > I have tried as-user-atexit and it does not work with Ctrl+c event. Don't > know about other exit events since my machine powers the light in question. > So the light goes off when

Re: Django with digital certificates

2016-09-13 Thread Erik Cederstrand
> Den 12. sep. 2016 kl. 15.24 skrev Dimitris Kougioumtzis : > > I have an application with django framework. The users have in their usb > sticks their certificates. How to access their certificates from the django > application to the client computer Do you have a Django

Re: Recipe to upgrade to Python 3.x on Ubuntu 12.04 and 14.04

2016-09-08 Thread Erik Cederstrand
> Den 7. sep. 2016 kl. 10.49 skrev James Schneider : > > You may also want to consider building in a configuration manager such as > Ansible or Salt stack. Once set up, you can deploy multiple staging and prod > servers with a couple commands. With the right planning,

Re: Maintaining old django code

2016-09-06 Thread Erik Cederstrand
> Den 6. sep. 2016 kl. 10.20 skrev Lekan Wahab : > > Good morning guys. > I was handed a project at work which was written as far back as 2012. > Quiet a lot of the packages used in the project are either no longer being > maintained. > Rebuilding the project from scratch is

Re: Signal handling when deleting lots of objects?

2016-09-01 Thread Erik Cederstrand
> Den 1. sep. 2016 kl. 20.14 skrev Stodge : > > I have two models, Volume and Group. The Volume model has a foreign key to > Group. > > When a user deletes a Volume the post_delete signal handler sends an HTTP > DELETE request (/volume) to another server process. This works

Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand
> Den 30. aug. 2016 kl. 11.20 skrev Erik Cederstrand > <erik+li...@cederstrand.dk>: > > I'm not even sure that's possible to express in SQL, but it would probably be > quite convoluted if it is. Here's an easier-to-understand solution: > > res = set() > for b in

Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand
> for b in B.objects.all().select_related('a').annotate(Max('date_created')): That should probably be: Max('a__b__date_created') instead. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand
I'm not even sure that's possible to express in SQL, but it would probably be quite convoluted if it is. Here's an easier-to-understand solution: res = set() for b in B.objects.all().select_related('a').annotate(Max('date_created')): if b.date_created != b.date_created__max: continue

Re: What is this? CASCADE clausule on DROP COLUMN???

2016-08-25 Thread Erik Cederstrand
> Den 25. aug. 2016 kl. 17.09 skrev RompePC : > > I did a migration of Django, and then applied a sqlmigrate, giving me this > output... > > BEGIN; > -- > -- Remove field my_column from my_table > -- > ALTER TABLE `my_table` DROP COLUMN `my_column` CASCADE; > > I

Re: How o run shell command in Django ?

2016-08-08 Thread Erik Cederstrand
> Den 8. aug. 2016 kl. 13.14 skrev Asad ur Rehman : > > Internal server error is coming.. If you want help, please be much more specific in your replies; post the relevant parts of the code, stacktraces, what have you tried already etc. I assume you already added

Re: How o run shell command in Django ?

2016-08-08 Thread Erik Cederstrand
> Den 8. aug. 2016 kl. 12.54 skrev Asad ur Rehman : > > from sh import fs_cli > this is also not working ... What's the error message? Did you install the 'sh' module (pip install sh)? Erik -- You received this message because you are subscribed to the Google

Re: How o run shell command in Django ?

2016-08-08 Thread Erik Cederstrand
I've had a lot of success interacting with the command-line by using the 'sh' module: http://amoffat.github.io/sh/ It's extremely simple but allows a lot of advanced features when you need them. I'm not on a system where fs_cli is avaliable, but you should be able to just do: from sh import

Re: Inconsistent dedent error

2016-06-23 Thread Erik Cederstrand
> Den 23. jun. 2016 kl. 21.21 skrev Gary Roach : > > class Choice(models.Model): >question = models.ForeignKey(Question, on_delete=models.CASCADE) >choice_text = models.CharField(max_length=200) >votes = models.IntegerField(default=0) > >

Re: How to aggregate on insert?

2016-05-24 Thread Erik Cederstrand
> Den 24. maj 2016 kl. 01.11 skrev James Schneider <jrschneide...@gmail.com>: > On Mon, May 23, 2016 at 12:58 PM, Erik Cederstrand > <erik+li...@cederstrand.dk> wrote: > > I have inherited a legacy Item model that has a composite unique key > consisting of a

Re: How to aggregate on insert?

2016-05-23 Thread Erik Cederstrand
> Den 23. maj 2016 kl. 22.49 skrev Ketan Bhatt : > > Hey Erik, > > What Django version are you on? I'm on Django 1.9. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

How to aggregate on insert?

2016-05-23 Thread Erik Cederstrand
Hi, I have inherited a legacy Item model that has a composite unique key consisting of a Customer ID and a per-customer, incrementing Item ID. Assume I can't change the model. On inserts, the legacy code would let the database increment the Item ID to avoid race conditions. Something like

Re: get all columns as a list

2016-05-20 Thread Erik Cederstrand
> Den 20. maj 2016 kl. 00.12 skrev Larry Martell : > > This is probably very simple, but I just can't figure out how to do it. > > I want to get all the columns in some rows as a list. I know I could > use values_list and flat=True and list all the columns, but is that

Re: Double free or Corruption error when using GeoDjango

2016-05-19 Thread Erik Cederstrand
> Den 19. maj 2016 kl. 22.17 skrev Tapan Pandita : > > I am running django 1.9.4 on gunicorn19.4.5 with the gevent worker > (gevent==1.0.2, greenlet==0.4.9). My app is deployed on heroku. For some > requests, I have noticed this error: "*** Error in >

Re: Proxy in front of django app

2016-05-16 Thread Erik Cederstrand
> Den 16. maj 2016 kl. 20.48 skrev Maks Materkov : > > Hi everyone! > > i' ve got an unusual question, that is probably not very specific to django. > We have a large multi-tenant django app, and we want to split all traffic > between two tenants (tenant 1 and tenant 2,

Re: How to flush/clear database for single app, i.e. NOT the Project?

2016-05-16 Thread Erik Cederstrand
> Den 16. maj 2016 kl. 19.16 skrev JoeCodeswell : > > How can I flush/clear database for single app, i.e. NOT the Project? > > I have a multi-app project. > In a particular app I created my model with single class. > I populated the db for that model with the Admin

Re: Displaying single-line progress while a management command runs

2016-05-09 Thread Erik Cederstrand
> Den 9. maj 2016 kl. 14.23 skrev Phil Gyford : > > I have a custom management command which calls a method in another class, > which fetches lots of data from a third-party API. Fetching the data could > take a few seconds or it could take over an hour, depending on the

Re: manipulate n insert field values

2016-05-04 Thread Erik Cederstrand
> Den 4. maj 2016 kl. 10.07 skrev Shameema Mohsin : > > > Z value calculation > > step1: converting lat and long to int > > latitude int = (latitude + 90) × 10^6 > longitude int = (latitude + 180) × 10^6 > > note 10^6 = 100 > > We

Re: manipulate n insert field values

2016-05-03 Thread Erik Cederstrand
> Den 3. maj 2016 kl. 02.45 skrev Shameema Mohsin : > > > Stil stuck with the z order calculation and usage of the property field. > Kindly help. I am new to Django, only knows php well. Where are you stuck? Show your error messages, current non-working code and

Re: manipulate n insert field values

2016-05-02 Thread Erik Cederstrand
> Den 2. maj 2016 kl. 15.38 skrev Shameema Mohsin : > > Could anybody help me out as I am new to Django. > In my model: > > from django.db import models > > class Employees(models.Model): >empId = models.AutoField(primary_key=True) >empName =

Re: Strange Bug

2016-04-22 Thread Erik Cederstrand
Hi Neto, > Den 22. apr. 2016 kl. 06.59 skrev Neto : > > [...] > class ActionLog(Log): > action = models.ForeignKey('Action', on_delete=models.SET_NULL) > > [...] > > ActionLog.objects.create(account=account, action=action) Something's wrong with your example.

Re: Issue with Django Password Normalization

2016-04-20 Thread Erik Cederstrand
> Den 20. apr. 2016 kl. 14.41 skrev Arun S : > > basically I would like to know if the latest version of django already > supports any kind of normalization for the login passwords. What exactly do you mean by "password normalization"? Do you want passwords to be

Design hints for a sanity checker

2016-04-15 Thread Erik Cederstrand
Hi list, I need to implement a sanity checker for my (power) users. Basically they should press a button on my website, and my backend runs a checklist of 20-30 items to check that their setup is OK and report progress while the checks are running. Some checks are fast, and others could take a

Re: Q() chaining with & returns empty set

2016-04-01 Thread Erik Cederstrand
> Den 31. mar. 2016 kl. 04.14 skrev Bai Shun : > > I've got a problem in using Q() To see what's going on, try to print the SQL that Django generates for working and non-working queryset: > print >

Re: reading CSV file with non ASCII characters

2016-02-05 Thread Erik Cederstrand
> Den 6. feb. 2016 kl. 09.14 skrev elcaiaimar : > > Hello, > > I have a CSV File and I want read it. The problem is that it has non ASCII > characters such as 'Ñ' and accents and I need that they are recognised to > save the CSV content in a DB. > > To simplify, I've

Re: Scaling Django

2016-02-03 Thread Erik Cederstrand
> Den 3. feb. 2016 kl. 22.30 skrev Joshua Pokotilow : > > At the startup where I work, we've written a lot of our server code in > Django. So far, we've adopted a "build it fast" mentality, so we invested > very little time in optimizing our code. A small amount of load

Re: How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Erik Cederstrand
> Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham : > > I have a ModelAdmin class where I am using callables to define accessors to a > foreign key's field. > > I.e. > > class MyAdmin(admin.ModelAdmin): > > def field_name(self, obj): > return

Re: Disable autocomplete in admin field

2015-11-13 Thread Erik Cederstrand
> Den 12. nov. 2015 kl. 14.41 skrev Erik Cederstrand > <erik+li...@cederstrand.dk>: > > Hi Ezequeil, > > Thanks for the explanation! This worked, but defining a new widget from > scratch meant that I lost the other helpful attributes (length, class etc.) > that

Re: Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
n your model admin, like this example > > https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#adding-custom-validation-to-the-admin > > > On Thu, Nov 12, 2015 at 8:46 AM, Erik Cederstrand <erik+li...@cederstrand.dk> > wrote: > Hello, > > I have a model with a CharField

Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
Hello, I have a model with a CharField named "username". When I edit a model instance in the admin, my browser likes to autocomplete the contents of the "username" field with my username for the Django site, regardless of what was entered previously. Is there anything I can do to disable this

Re: bug: mymodel.objects.first().get('id',None) AttributeError: 'NoneType' object has no attribute 'get'

2015-10-27 Thread Erik Cederstrand
> Den 27. okt. 2015 kl. 04.01 skrev gugeshi...@gmail.com: > > hi ,how are you > > i run > > myid=mymodel.objects.first().get('id',None) > > If there is a record, it's ok > > If there is no record, error info: > > AttributeError: 'NoneType' object has no attribute 'get' > > > If there

Re: What is the recommended schema design for dynamic dates in Django for PostgreSQL?

2015-10-21 Thread Erik Cederstrand
> Den 20. okt. 2015 kl. 18.09 skrev Radek Svarz : > > Hi Erik, > > thanks for m2m suggestion. > > What do you think about using suggested view in DB? (@SO) (i.e. the DB would > do the conversion on the fly) In general, I think of DB views as either a performance

Re: What is the recommended schema design for dynamic dates in Django for PostgreSQL?

2015-10-20 Thread Erik Cederstrand
> Den 20. okt. 2015 kl. 14.09 skrev Radek Svarz : > > [...] > Django code and further long details are @ SO: > http://stackoverflow.com/questions/33167079/what-is-the-recommended-schema-design-for-dynamic-dates-in-django-for-postgresql > Regarding your need for a way

Re: What is the recommended schema design for dynamic dates in Django for PostgreSQL?

2015-10-20 Thread Erik Cederstrand
> Den 20. okt. 2015 kl. 14.09 skrev Radek Svarz : > > [...] > 1 Milestone is a date stored as a string in form -MM-DD or a special tag > "today", which means daily changing date (dynamic - the date was not stated, > but until today is some state valid - if today is

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
> Den 16/09/2015 kl. 19.08 skrev Simon Charette : > > If you want to use this approach I'm afraid you'll have to do > what prefetch_related does under the hood by yourself. > > e.g. > > from collections import defaultdict > > prefetched = defaultdict(list) > subjects =

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
> Den 17/09/2015 kl. 09.22 skrev Javier Guerra Giraldez <jav...@guerrag.com>: > > On Thu, Sep 17, 2015 at 2:07 AM, Erik Cederstrand > <erik+li...@cederstrand.dk> wrote: >>> Den 16/09/2015 kl. 16.45 skrev Mike Dewhirst <mi...@dewhirst.com.au>: >>&

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
> Den 16/09/2015 kl. 16.45 skrev Mike Dewhirst <mi...@dewhirst.com.au>: > > On 16/09/2015 9:53 AM, Erik Cederstrand wrote: >> Hi folks, >> >> I'm working on a school timetable app. I want to fetch hundreds of >> thousands of Lesson instances with prefetch

Prefetch() with through models

2015-09-16 Thread Erik Cederstrand
Hi folks, I'm working on a school timetable app. I want to fetch hundreds of thousands of Lesson instances with prefetched m2m relations (e.g. subjects). My m2m relations use through models (I'm not sure this actually makes a difference here), and I'm running into performance issues because

Re: Strip ArrayField input from admin

2015-09-03 Thread Erik Cederstrand
> Den 18/08/2015 kl. 10.54 skrev Erik Cederstrand <erik+li...@cederstrand.dk>: > > Hi list > > I have a model with a field defined like this: > > categories = ArrayField(models.CharField(max_length=32)) > > > This field is accessible via the admin

Strip ArrayField input from admin

2015-08-18 Thread Erik Cederstrand
Hi list I have a model with a field defined like this: categories = ArrayField(models.CharField(max_length=32)) This field is accessible via the admin interface, and when I enter comma-separated values in the charfield, they are stored as an array in the DB. However, I just discovered

Re: bulk add m2m relationship for multiple instances

2015-08-13 Thread Erik Cederstrand
> Den 13/08/2015 kl. 04.09 skrev yakkades...@gmail.com: > > I'll run a test with the dict vs list+position counter. I know I saw a speed > improvement but I can't remember if that was the only thing I changed. > > I'd have to change a lot of code if I change the DB scheme so I'm not wanting

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
> Den 12/08/2015 kl. 20.00 skrev yakkades...@gmail.com: > > In the actually code I create and preload all the DataPoints and Sensors > outside the loop. I found a dict was too slow for DataPoints. That's suspicious. Compared to loading data from the database, Python dicts are not slow, for

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
> Den 12/08/2015 kl. 04.47 skrev yakkades...@gmail.com: > > for row in rows: > dp = DataPoint.objects.get(Taken_datetime=row['date']) > > sensorToAdd = [] > for sensor in sensors: > s = Sensor.objects.get(Name=sensor.name, Value=sensor.value ) > sensorToAdd.append(

Re: Django M2M with Oracle database FieldDoesNotExist error

2015-08-03 Thread Erik Cederstrand
> Den 03/08/2015 kl. 08.50 skrev mohsenba...@gmail.com: > > Hello Django community. > I have two Django models Foo and Bar that have a ManyToMany relation: > > Class Foo(models.model): > > ... > > bars = models.ManyToManyField('Bar', related_name='foos') > somewhere in the code, i do

Re: post_delete and determining if a related object has been deleted

2015-07-28 Thread Erik Cederstrand
> Den 28/07/2015 kl. 14.36 skrev Stefan Schindler : > >> This makes no sense to me. You want to delete an Item or Order but >> then immediately create a new one? > > My actual goal is this: Whenever an Item object itself is deleted, I > want to create a LogEntry object

Re: post_delete and determining if a related object has been deleted

2015-07-28 Thread Erik Cederstrand
> Den 28/07/2015 kl. 09.37 skrev Stefan Schindler : > > If the Order object itself is deleted, all post_delete handlers of all > related objects are fired, including Item. Item however stores a new > object with a relation to the *deleted Order* object, which will > result in a

Re: System requirements

2015-07-27 Thread Erik Cederstrand
> Den 27/07/2015 kl. 20.48 skrev Ingo Hohmann : > > Thank you. > > It's the age old problem between management and development. I'd say develop > on a small server, and then test how far it can go. But someone wants to know > _now_. Well, then tell them that the

Re: System requirements

2015-07-27 Thread Erik Cederstrand
> Den 27/07/2015 kl. 07.32 skrev Ingo Hohmann : > > Hi, > > I'm new to django, and I would like to get a hint about system requirements. > If you know about any helpful links, these are welcome, too. So far what I > dog up by googlng wasn't too helpful. > > Currently

Re: preserve data when migrating ForeignKey to ManyToManyField

2015-07-15 Thread Erik Cederstrand
> Den 14/07/2015 kl. 23.32 skrev A Lee : > > I'd like to change a ForeignKey field into a ManyToManyField, preserving > existing data by creating entries in the many-to-many through table. Running > makemigrations after changing the model class creates a migration that

Re: Custom UserChangeForm shows one list correctly and the other doesn't show values

2015-06-20 Thread Erik Cederstrand
> Den 20/06/2015 kl. 14.20 skrev Néstor Boscán : > > I've created a custom UserChangeForm in DJango 1.7.8 where I have 2 custom > ComboBox associated with a Model. Both are defined exactly the same. One > shows the values and the + button to add a new entity. The second

Re: Django 1.8 Transaction Begin

2015-06-18 Thread Erik Cederstrand
> Den 18/06/2015 kl. 17.49 skrev Carl Meyer : > > I wrote a blog post [2] which discusses this in more detail. It's about > PostgreSQL instead of MySQL, but the part near the beginning about PEP > 249 and Django applies equally well to MySQL (I think; I'm not very > familiar

Re: Squashed migration

2015-06-12 Thread Erik Cederstrand
> Den 12/06/2015 kl. 11.38 skrev Cherie Pun >: > > Hi, > > I have trying to experiment with squashmigration to see if it will make it > faster to build the database when running tests. So I have squashed the > migrations following

Re: Bug in Django? It throws server error when context processor raises Http404

2015-06-09 Thread Erik Cederstrand
> Den 09/06/2015 kl. 18.54 skrev Alexey Grigoriev : > > I found this issue in my big project. And then I started new Django project > from scratch, and reproduced the problem. > You can reproduce this bug: > 1) start new Django project > 2) create context processor that

Re: heavy refactoring

2015-06-09 Thread Erik Cederstrand
> Den 09/06/2015 kl. 10.09 skrev Mike Dewhirst : > > Does anyone have any experience with app-renames and maybe some refactoring > advice for me? > > Maybe I don't even need to replace and destroy ... If you wanted, you could set Meta.db_table for all models to the

Re: Graph theory ??

2015-06-02 Thread Erik Cederstrand
Hi Rafael, Assuming you have a static and limited set of actions, and they can only be defined programmatically, I would do something like this: class Vertex(models.Model): some_field = models.CharField() class Edge(models.Model): from = models.ForeignKey(Vertex,

Custom RelatedManager?

2015-05-22 Thread Erik Cederstrand
Hi folks, I have some models with a custom Manager that prefetches certain fields: class PrefetchManager(models.Manager): def get_queryset(self): return super().get_queryset()\ .select_related(*self.model.select_fields)\

Re: Improve Performance in Admin ManyToMany

2015-05-17 Thread Erik Cederstrand
> Den 15/05/2015 kl. 20.54 skrev Timothy W. Cook : > > def formfield_for_many_to_many(self, db_field, *args, **kwargs): > formfield = super(ClusterAdmin, > self).formfield_for_many_to_many(db_field, *args, **kwargs) > if db_field.name in >

Re: Improve Performance in Admin ManyToMany

2015-05-16 Thread Erik Cederstrand
> Den 15/05/2015 kl. 20.54 skrev Timothy W. Cook : > > def formfield_for_many_to_many(self, db_field, *args, **kwargs): > formfield = super(ClusterAdmin, > self).formfield_for_many_to_many(db_field, *args, **kwargs) > if db_field.name in >

Re: Improve Performance in Admin ManyToMany

2015-05-15 Thread Erik Cederstrand
> Den 14/05/2015 kl. 22.19 skrev Timothy W. Cook : > > That is exactly the problem Simon. Everyone of those models reference a > model called Project. I did this so that when the items are displayed in the > selects, the user knows which project it is from. In the interim I

Re: Ensure an object is saved even when the atomic bock rollsback

2015-05-08 Thread Erik Cederstrand
> Den 08/05/2015 kl. 15.15 skrev Marc Aymerich : > > HI, > > I'm using atomic requests, but one of my views needs to save a model > regardless of wheter the current transaction rolls back or not. > > I'm confused about how to proceed with the current autocommit

Re: How to represent a calendar month as a field in django models

2015-05-04 Thread Erik Cederstrand
> Den 04/05/2015 kl. 14.21 skrev Erik Cederstrand <erik+li...@cederstrand.dk>: > > class Month(models.Model): >year = models.IntegerField() >month = models.PositiveSmallIntegerField() > >def add_months(self, n): >assert n >= 0 >

Re: How to represent a calendar month as a field in django models

2015-05-04 Thread Erik Cederstrand
> Den 04/05/2015 kl. 13.26 skrev Matthys Kroon : > > I'm specifically looking at only situations where the year and month alone > are significant. > > The downside I see with using a DateField and forcing the day to the first of > the month, with custom widget etc. is that

Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-21 Thread Erik Cederstrand
> Den 21/04/2015 kl. 09.20 skrev SHINTO PETER : > > Hi > François Schiettecatte , limit memory and CPU usage for python socket client > service Really, if you want qualified help, you need to be more verbose. Do you want to kill a process violating your limits? Or can

Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread Erik Cederstrand
> Den 20/04/2015 kl. 19.46 skrev SHINTO PETER : > > Working with linux/unix If unix includes FreeBSD, check out https://www.freebsd.org/doc/en/books/handbook/security-resourcelimits.html Erik -- You received this message because you are subscribed to the Google Groups

Re: how to access manager from a model instance?

2015-03-26 Thread Erik Cederstrand
> Den 25/03/2015 kl. 20.20 skrev felix : > > Yes I know I can't acces the Manager from a model instance, but I need to > check the value of a field saved in the database before updating it. Can I do > it from the Model clean() method? Depending on your requirements,

Re: Re-run only tests that failed last time

2015-03-24 Thread Erik Cederstrand
> Den 24/03/2015 kl. 11.27 skrev Gergely Polonkai : > > I have a pretty extended test suite for my application, which can run for > about 15 minutes. Now when I introduce an error, I will be notified of it > pretty late, and a one-liner fix needs another 15 minutes to

Fwd: attaching an app to site via apphook fails. server crashes only (beginner question)

2015-03-06 Thread Erik Cederstrand
> Start på videresendt besked: > > Dato: 6. mar. 2015 kl. 09.49.01 CET > Fra: inoyon artlover KLANGRAUSCH > Til: django-users@googlegroups.com > Emne: attaching an app to site via apphook fails. server crashes only > (beginner question) > > I created a site and

Re: django doesnt wait for my time.sleep

2015-03-04 Thread Erik Cederstrand
> Den 04/03/2015 kl. 18.03 skrev dk : > > i am using matplotlib to generate a plot/graph, even do that python is > generating the file and saving it so I can use it later on in my web page, > django show the page before the process finish, > so I decided to put a

Re: Gunicorn sock file is missing?

2015-02-26 Thread Erik Cederstrand
> Den 26/02/2015 kl. 07.56 skrev Kaloian : > > Hi Erik, > > No it doesn't start at all, running the gunicorn_start script gives: > > [ERROR] Retrying in 1 second. > [ERROR] Retrying in 1 second. > [ERROR] Retrying in 1 second. > [ERROR] Retrying in 1 second. >

Re: TypeError: __str__ returned non-string (type bytes)

2015-02-25 Thread Erik Cederstrand
> Den 25/02/2015 kl. 05.33 skrev Mike Dewhirst : > > == > ERROR: test_checkreference_exp (substance.tests.test_substance.TestSubstance) >

Re: Gunicorn sock file is missing?

2015-02-25 Thread Erik Cederstrand
> Den 25/02/2015 kl. 07.16 skrev Kaloian : > > I have an ansible provisioned VM based on this one > https://github.com/jcalazan/ansible-django-stack but for some reason trying > to start Gunicorn gives the following error: > > Can't connect to

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
> Den 10/02/2015 kl. 23.45 skrev Carl Meyer : > > Yes, that's what I said :-) Thanks for the great explanations; I didn't see your previous answer before posting my latest reply, hence the duplicate explanations :-) > >> My code relies on isolation level "Serializable" for a

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
Den 10/02/2015 kl. 21.27 skrev Erik Cederstrand <erik+li...@cederstrand.dk>: > > Running this in parallel in two processes on the same machine returns this > after a while: > > Process A: > [...] > > Process B: > [...] > Traceback (most recent ca

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
Hi Carl, > Den 10/02/2015 kl. 18.34 skrev Carl Meyer >: > > I assume you're using the 'db' cache backend? Otherwise, it wouldn't > make sense to expect transactions to affect cache calls at all. Yes, I'm using the db backend. > The difference

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
> Den 10/02/2015 kl. 17.15 skrev Erik Cederstrand <erik+li...@cederstrand.dk>: > > Hi list, > > I'm tracking down a bug in my app that shouldn't be happening with the > transaction statements I added in my code. In my logging settings, I can set > 'django.d

Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
Hi list, I'm tracking down a bug in my app that shouldn't be happening with the transaction statements I added in my code. In my logging settings, I can set 'django.db.backends' to DEBUG to log the queries (I'm using the postresql backend). I see 'SAVEPOINT' statements logged, but I also need

Re: Pillow on QPython3

2015-02-03 Thread Erik Cederstrand
> Den 03/02/2015 kl. 14.36 skrev ADEWALE ADISA : > > Hi guys, am try to setup django tutorial with QPython3 on android device. But > the problem is am unable to install Pillow on the Qpython3. Its just giving > me various error. I try Qpython forum but with no avail.

Re: When do I have to call save() on a Model Instance?

2015-01-30 Thread Erik Cederstrand
> Den 29/01/2015 kl. 19.40 skrev Tobias Dacoir : > > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as I > keep the object and a pointer to it in memory I can freely modify it in > several Functions before

Re: django select extremely slow on large table

2015-01-23 Thread Erik Cederstrand
> Den 23/01/2015 kl. 08.19 skrev James Schneider : > > How many results do you typically get back from that query? There should be only one result, right? Since the "markid" field is defined as unique and OP is filtering on that with a single value. First thing to

Re: Authentication when usernames are not unique

2015-01-20 Thread Erik Cederstrand
Ok, here's a stripped-down solution. I ended up creating a new SchoolUser user model with a OneToOne relation to my LegacyUser, to keep the LegacyUser model uncluttered. The SchoolUser implements all methods from AbstractBaseUser and PermissionsMixin but doesn't inherit from them, because I

Re: Authentication when usernames are not unique

2015-01-19 Thread Erik Cederstrand
Hi guys, Thanks for a lot of useful answers! My schools use a palette of authentication systems; regular hashed password check with a hash I have access to, LDAP auth and WAYF (a Danish educational SSO solution using Shibboleth). Those are the least of my worries right now, though. I'll have

Authentication when usernames are not unique

2015-01-19 Thread Erik Cederstrand
Hello I'm creating a Django frontend for a legacy school system. The legacy system has users, but usernames are only unique together with a school: class LegacyUser(models.Model): school = models.ForeignKey(School) username = models.CharField(max_length=40) class Meta:

Re: Lock Django DB on 9 of 10 concurrent uwsgi workers - how to?

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 19.24 skrev Andreas Krueger : > > > > What is the most elegant way to > > lock the Django DB while I make a complex transaction (read, decide, write) > > ... during which no other uwsgi worker should have access (or at least no > write access)

Re: installation of mysqlclient

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 20.28 skrev th.gran...@free.fr: > Thanks but i have a problem! > > when i launch the install command i get these errors > > Downloading mysqlclient-1.3.4.tar.gz (77kB) >100% || 77kB 356kB/s >/bin/sh: 1: mysql_config: not found >

Re: installation of mysqlclient

2015-01-19 Thread Erik Cederstrand
> Den 19/01/2015 kl. 19.55 skrev th.gran...@free.fr: > > Hello > > i am trying to use Dkango with Python3.4.2 and mysql > > i have downloaded mysqlclient-1.3.4 but i don't know how to install it. it's > a .whl file > > Can you help me please? Just use pip instead. This should get you the

Re: filter

2015-01-16 Thread Erik Cederstrand
You're overwriting one QuerySet with another: new_leave =newleave.objects.filter(department_head_authorization="Approved" ) new_leave = newleave.objects.filter(department="FMKD") Instead, do this: new_leave = newleave.objects.filter(department_head_authorization="Approved", department="FMKD")

Re: [HELP] Custom 2 step authentication where the user's password is a public key

2015-01-09 Thread Erik Cederstrand
> Den 09/01/2015 kl. 12.28 skrev Alon Muroch : > > Hey everyone, i've been thinking of implementing the following custom > authentication scheme: > • User generates a public and private key pair > • when creating a new user, the user name is as usual but the

Re: Problem with for and if

2015-01-06 Thread Erik Cederstrand
> Den 05/01/2015 kl. 22.45 skrev Dariusz Mysior : > > I try develop this code to get a number of position this letter in word, and > I have it but for example if i search letter "t" I get "1, 5, b", why I get b > instead of 11??? > > def gen2(): >count=0 >

Re: Thinking about EAV database model for flexibility. How (in)compatible is it with the django model?

2014-12-22 Thread Erik Cederstrand
> Den 22/12/2014 kl. 11.27 skrev Felipe Faraggi : > > I'd like to 're-open' this question to ask another (maybe) short one: > > Therefore, is django not very suitable for NOSQL databases like mongo or > couch or others in general? > Or is the problem specifically using

Re: Raw access to cache table

2014-12-22 Thread Erik Cederstrand
Hi Russel, > Den 22/12/2014 kl. 00.40 skrev Russell Keith-Magee : > > If you *do* want to do complex queries on the database cache table, the > approach suggested by Collin is as good an approach as any. A managed table > will give you ORM operations over an arbitrary

  1   2   >