Re: It is impossible to add a non-nullable field 'details1' to feature without specifying a default. This is because the database needs something to populate existing rows.

2023-03-27 Thread Erik Manuel Herazo Jimenez
hello, you must apply the default=None, or default="" feature, so that those fields can be filled. ex: details1 = models.CharField(max_length=500, default="") El sáb, 25 mar 2023 a la(s) 07:59, Ebenezer Otchere (swazyman1...@gmail.com) escribió: > Am new in django and have been getting errors in

Re: User model as ForeignKey forcing username instead of id.

2022-11-23 Thread Erik Manuel Herazo Jimenez
why don't you try to return it by context using a dictionary?, specify where what is the key and what is the value El mié, 23 de nov. de 2022 10:19 a. m., Blaine Wimberly < blaine5...@gmail.com> escribió: > Issue resolved. > > In pure frustration, I dumped the database and deleted all migrations.

Hiring an engineer in San Francisco

2019-12-09 Thread Erik Gunderson
PollyEx is hiring a full stack software engineer with an emphasis in django. Our team is looking for a full-time employee able to work in our San Francisco office. The stack is python/django/pandas/vue/heroku To apply visit - https://jobs.lever.co/pollyex/23e8fee3-8a9f-4bf1-9943-8584ab9b6c0a o

Re: Custom forms in Django admin?

2019-04-08 Thread Erik van widenfelt
ion) <https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/#validation-on-a-modelform>). With a custom form, I can do a more comprehensive validation of the user's input. hope this helps -erik On Monday, April 8, 2019 at 4:26:12 AM UTC-5, Kevin Olbrich wrote: > >

Performance comparison for several Database Types?

2018-06-09 Thread Erik Rull
ference between Windows and Linux. Thanks. Best regards, Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: Office365/SharePoint Online Integration

2017-12-15 Thread Erik Cederstrand
ut I've used https://pypi.python.org/pypi/sharepoint previously with some success to work with SharePoint sites. I don't think it supports file uploads directly, but you could use it as a starting point to explore the Sharepoint SOAP API. But maybe Office365 Sharepoint sites also offer a mo

Re: hello everyone! I'm working on Django Framework. but

2017-10-19 Thread Erik Rull
I > wouldn't allow it to be accessible to the Internet That's clear. No forwarding from/to any public IP is existing. > > Regards, > > Andréas > Best regards, Erik -- You received this message because you are subscribed to the Google Groups "Django user

Re: hello everyone! I'm working on Django Framework. but when I run the script $ ./manage.py runserver or $./manage.py runserver 0.0.0.0:8000 it only work on my system. how to make it public? so that

2017-10-19 Thread Erik Rull
imizations are disabled when using runserver? Is the overall performance of all queries and generating the HTML response itself slower? I know that only one request is handled in parallel, but that's okay, I'm the only one accessing the pages :-) > Best regards, > > Andréas Best rega

Re: Abridged summary of django-users@googlegroups.com - 25 updates in 12 topics

2017-01-05 Thread Erik Mvñoz
Hello, I am Erik... noob to Django... i am getting a circular import error on importing urls.py any suggestions On Wed, Jan 4, 2017 at 5:03 AM, wrote: > django-users@googlegroups.com > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/django-users/topi

Re: transferring data between Postgres databases

2016-10-24 Thread Erik Cederstrand
Postgres but in > the meantime can anyone suggest any shortcuts? How much data are we talking about? Is it too much for django-admin dumpdata/loaddata to handle? Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscrib

Re: Sharding DB: one database per user dynamically

2016-10-06 Thread Erik Cederstrand
rmance reasons, not business logic. It goes beyond just splitting data into multiple databases with identical schemas, BTW. https://en.wikipedia.org/wiki/Shard_(database_architecture) Erik -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Sharding DB: one database per user dynamically

2016-10-06 Thread Erik Cederstrand
he above to accept the added complexity and possible fighting with Django the get it to work. Unless you have clear technical or legal requirements that dictate separate databases, just write export and import scripts that know to do "WHERE user_id = XXX" on the relevant tables. Erik

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 te

Re: covert julian date to calander date

2016-09-20 Thread Erik Cederstrand
on correctly, that should be easy. Just convert the Julian date to a Python date in your view: my_date = (datetime.datetime(my_year, 1, 1) + datetime.timedelta(days=julian_day)).date() Erik -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Django exit function

2016-09-14 Thread Erik Cederstrand
e simpler and more fool-proof solution. Use cron if you can live with 1-minute resolution, otherwise use one of the many available service monitoring tools to check if your WSGI server is running and call turn_the_light_off() if not. Erik -- You received this message because you are subscribed to the

Re: Django with digital certificates

2016-09-13 Thread Erik Cederstrand
in general) for security reasons. I believe some of the Yubico products can emulate a keyboard, in which case the YubiKey simply types the secure token for you. That should work in a browser. Erik -- You received this message because you are subscribed to the Google Groups "Django users&qu

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

2016-09-08 Thread Erik Cederstrand
jango project and not having a requirements.txt. Sure, you can pip install everything manually and memorize which packages you're using and which versions are compatible with your project, but a list of requirements is just so much better. Erik -- You received this message because you are

Re: Maintaining old django code

2016-09-06 Thread Erik Cederstrand
the supported and recommended way. Even though that's six versions to upgrade to, it will probably save you time in the long run instead of upgrading from 1.4 -> 1.10 in one go. Happy coding! Erik -- You received this message because you are subscribed to the Google Groups "Djan

Re: Signal handling when deleting lots of objects?

2016-09-01 Thread Erik Cederstrand
itly, telling delete() not to signal: for v in instance.volumes.all(): v.delete(signal=False) requests.delete('/group/%s' % instance.pk) Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscri

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

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 uns

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

2016-08-30 Thread Erik Cederstrand
because 'date_created' is not unique so there could be two B objects with the same 'a' and 'date_created' values. Erik > Den 30. aug. 2016 kl. 08.33 skrev Web Architect : > > Hi, > > I am looking for an elegant and efficient mechanism to have a que

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

2016-08-25 Thread Erik Cederstrand
only for postgresql. CASCADE defines what to do if anything outside the table references the column. CASCADE will drop these references. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rec

Re: How o run shell command in Django ?

2016-08-08 Thread Erik Cederstrand
e commandline (make sure you're in the same virtualenv as the server running your Django code) and do: >>> from sh import fs_cli If that works, we need a full stacktrace from Django to see what's going on. Erik -- You received this message because you are subscribed to the G

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 G

Re: How o run shell command in Django ?

2016-08-08 Thread Erik Cederstrand
just do: from sh import fs_cli result = fs_cli('-x') And put that somewhere useful in your Django code, e.g. in a view or a management command. Erik > Den 8. aug. 2016 kl. 11.33 skrev Asad ur Rehman : > > I want to run fs_cli -x command in django . Can anybody help m

Re: Inconsistent dedent error

2016-06-23 Thread Erik Cederstrand
4-space indented. Python requires you to have consistent indenting, preferably 4 spaces per every indentation level. Your editor should help you with that. See https://www.python.org/dev/peps/pep-0008/#indentation Erik -- You received this message because you are subscribed to the Google Gro

Re: How to aggregate on insert?

2016-05-24 Thread Erik Cederstrand
> Den 24. maj 2016 kl. 01.11 skrev James Schneider : > On Mon, May 23, 2016 at 12:58 PM, Erik Cederstrand > wrote: > > 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 &g

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

How to aggregate on insert?

2016-05-23 Thread Erik Cederstrand
n: i = Item(customer_id=123, name='MyItem', ...) i.item_id = Item.objects.filter(customer_id=123).aggregate(Max('item_id'))['item_id__max'] + 1 i.save() Or do I just wrap that in a loop and catch IntegrityError if I don't want to use raw SQL? Thank

Re: get all columns as a list

2016-05-19 Thread Erik Cederstrand
> the only way? > > I want to do something like this: > > rows = FOO.objects.filter(bar='baz') > > and get a list of lists instead a list of FOO objects. "MyModel.objects.filter().values_list()" returns a list of tuples with all column values in MyModel._m

Re: Double free or Corruption error when using GeoDjango

2016-05-19 Thread Erik Cederstrand
s crashing with a memory violation in C/C++ code in either Python or an external module (e.g. gevent). Unfortunately, your stack trace leaves no further hints about the source of the problem. Normally, you would compile Python and any external C modules with debugging symbols and attach a debugger

Re: Proxy in front of django app

2016-05-16 Thread Erik Cederstrand
t and passes it on to the correct backend. This keeps your code within Django. But this also requires two trips all the way down your stack and may not yield performance. I've had great success in the past with Nginx scripting, so that would be my next suggestion if the above are not viable. It

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

2016-05-16 Thread Erik Cederstrand
1.9/topics/migrations/#data-migrations) that deletes all relevant model instances, and place the migration before the migration that adds the ForeignKey. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

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

2016-05-09 Thread Erik Cederstrand
= logging.getLogger('') h = OverwriteHandler() log.addHandler(h) class Command(BaseCommand): def handle(self, silent=False, **options): log.setLevel(logging.DEBUG if silent else logging.INFO) log.info('1 of 2') time.sleep(1) log.info('2 of 2')

Re: manipulate n insert field values

2016-05-04 Thread Erik Cederstrand
ut asking for a full Python implementation of the above is too much to ask for free help for. Implement it in PHP if that's what you're familiar with, and grab a Python handbook to look up the equivalent Python syntax. Erik -- You received this message because you are subscribed to the

Re: manipulate n insert field values

2016-05-03 Thread Erik Cederstrand
es(models.Model): [...] @property def zval(self): return get_z_order(self.empLat, self.empLong) You can then access zval as if it was a model field. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: manipulate n insert field values

2016-05-02 Thread Erik Cederstrand
= # your calculation here super().save(*args, **kwargs) Beware that save() is not always called. For example, bulk_create() doesn't call save(). You need to handle these situations yourself. Erik -- You received this message because you are subscribed to the Google Groups "

Re: Strange Bug

2016-04-21 Thread Erik Cederstrand
your example. The ActionLog class only has an 'action' field, but you're creating an ActionLog instance as if it has both 'action' and 'account'. Erik -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Issue with Django Password Normalization

2016-04-20 Thread Erik Cederstrand
rs, etc) then override AuthenticationForm.clean_password() and raise ValidationError() for your rules. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr

Design hints for a sanity checker

2016-04-15 Thread Erik Cederstrand
long time - testing connections to external systems and things like that. I'm still a static HTML kinda guy, so I'm looking for hints on how to design this with Django. I'm looking for something simple, but also best practice so I learn the right habits from the start :-) Thanks

Re: Q() chaining with & returns empty set

2016-03-31 Thread Erik Cederstrand
&Q(fruit__ofkind__name__in=['banana'])).distinct() > Basket.objects.filter(fruit__ofkind__name__in=['apple']).filter(fruit__ofkind__name__in=['banana']).distinct() Print SQL like this: print(my_queryset.query) Erik -- You received this message b

custom FORMAT_SETTINGS

2016-03-19 Thread Erik Stein
.get_format Django checks the hard coded list of possible FORMAT_SETTINGS and returns the placeholder string if it doesn't know the format. Do I missing something or is it just not possible currently to extend the default formats? best -- erik -- You received this message because yo

Re: custom FORMAT_SETTINGS

2016-03-18 Thread Erik Stein
Nevermind, I reused the locale-directory for the format-definitions and didn't realize, that the path has to be a python module (or: didn't realize, that the locale directory isn't a module by default). best -- erik On 18.03.2016 11:08, Erik Stein wrote: hello -- I&#

Re: reading CSV file with non ASCII characters

2016-02-05 Thread Erik Cederstrand
reader = csv.DictReader(open("file.csv", "rb", encoding='utf-8')) See https://docs.python.org/3/library/functions.html#open For Python 2, have a look at the notes about encodings in https://docs.python.org/2/library/csv.html Erik -- You received this message b

Re: Scaling Django

2016-02-03 Thread Erik Cederstrand
Django doesn't scale". The year "monolithic" is an argument in itself is the year of the HURD desktop. Except if you're programming in VBScript. Then by all means, rewrite. Erik -- You received this message because you are subscribed to the Google Groups "Dj

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

2016-01-11 Thread Erik Cederstrand
ription' option described in https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivin

Re: Disable autocomplete in admin field

2015-11-13 Thread Erik Cederstrand
> Den 12. nov. 2015 kl. 14.41 skrev Erik Cederstrand > : > > 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 the admin adds for me. Inste

Re: Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
code: class MyAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['username'].widget.attrs['autocomplete'] = 'off' Erik > Den 12. nov. 2015 kl. 13.33 skrev Ezequiel Bertti : > >

Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
n do to disable this behaviour, except for renaming the field to "username_PLEASE_DONT_AUTOCOMPLETE_SAFARI_IM_LOOKING_AT_YOU"? Thanks, Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group an

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

2015-10-27 Thread Erik Cederstrand
27;NoneType' object has no attribute 'get' > > > If there is a record,Can you let it return an empty dictionary, I don't see how .get() would not throw an AttributeError if first() returns a mymodel instance, but here's one solution to your problem: myid = mym

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 o

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

2015-10-20 Thread Erik Cederstrand
to denote "natural language" relative dates, take a look at https://pypi.python.org/pypi/dateparser. You could either use that directly or build on top of it. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscr

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

2015-10-20 Thread Erik Cederstrand
ng N duplicate date fields. Either use null=True to denote your concept of "today", or add a separate Boolean field "is_today" on the "Milestone" model. Erik -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
up my queries exponentially; 10-50x improvement in my tests so far. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
> Den 17/09/2015 kl. 09.22 skrev Javier Guerra Giraldez : > > On Thu, Sep 17, 2015 at 2:07 AM, Erik Cederstrand > wrote: >>> Den 16/09/2015 kl. 16.45 skrev Mike Dewhirst : >>> >>> On 16/09/2015 9:53 AM, Erik Cederstrand wrote: >>>> issues

Re: Prefetch() with through models

2015-09-17 Thread Erik Cederstrand
> Den 16/09/2015 kl. 16.45 skrev Mike Dewhirst : > > 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 prefetched m2m relations (e

Prefetch() with through models

2015-09-16 Thread Erik Cederstrand
extra filters are added to the prefetch query, but the huge IN clause is still there. Am I using Prefetch() wrong? Are there any other techniques to avoid the huge IN clause in prefetch queries? Thanks, Erik -- You received this message because you are subscribed to the Google Groups "

Re: access django admin got error 500

2015-09-14 Thread erik freaks
are you hosting this web site ? > > Sent from my HTC > > ----- Reply message - > From: "erik freaks" > To: > Subject: access django admin got error 500 > Date: Fri, Sep 11, 2015 8:29 AM > > > Hi, I'm new in django, I had create simple website

access django admin got error 500

2015-09-10 Thread erik freaks
Hi, I'm new in django, I had create simple website using django and deploy it to apache server, but when I try to access admin page I got error 500.. please someone with experience with django+apache help me.. thanks -- You received this message because you are subscribed to the Google Groups "

Re: Strip ArrayField input from admin

2015-09-02 Thread Erik Cederstrand
> Den 18/08/2015 kl. 10.54 skrev 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 &

Strip ArrayField input from admin

2015-08-18 Thread Erik Cederstrand
that if I enter comma+space separated values, e.g. "teachers, locations, students", it gets converted to ['teachers', ' locations', ' students'] which is not what I want. How go I get the ArrayField to strip the values after splitting by comma? Thanks, Eri

Re: bulk add m2m relationship for multiple instances

2015-08-13 Thread Erik Cederstrand
ate model just makes this explicit. The only thing this changes in your code is that you can't do "my_datapoint.sensors.add(my_sensor)" anymore. You need to always create (and delete) a DatapointSensorRel explicitly. Erik -- You received this message because you are subscribed to

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
atapointSensorRel(datapoint=d, sensor=s) for d, s in my_collected_relations] DatapointSensorRel.objects.bulk_create(relations) Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
one go instead of per-object. You should probably add indexes on DataPoint.Taken_datetime and Sensors.[Name, Value] to increase query performance. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Django M2M with Oracle database FieldDoesNotExist error

2015-08-03 Thread Erik Cederstrand
me='foos') > somewhere in the code, i do direct assignment to replace the relation with a > new list: > > foo_object.bars = [bar_object_list] You can't do that, AFAIK. You need to do: foo_object.bars.clear() foo_object.bars.add(*bar_object_list) Erik -- You re

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

2015-07-28 Thread Erik Cederstrand
this what you really wanted? # item.delete() super().delete(*args, **kwargs) class Item(models.Model): def delete(self, *args, **kwargs): if self.order: LogEntry(order=instance.order).save() super().delete(*args, **kwargs) Erik -- You received this messag

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

2015-07-28 Thread Erik Cederstrand
; argument of ForeignKey fields: https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.on_delete 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: System requirements

2015-07-27 Thread Erik Cederstrand
the waterfall development model died in the 90's. Or, estimate the impossibly hand-wavy "Expect unexpected changes in several ways" at somewhere between 0 and €140 mio yearly. Erik -- You received this message because you are subscribed to the Google Groups "Django us

Re: System requirements

2015-07-27 Thread Erik Cederstrand
your metrics. To increase performance, you can either improve your software or add hardware. The former is expensive in salary, the latter is expensive in invoices. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: preserve data when migrating ForeignKey to ManyToManyField

2015-07-15 Thread Erik Cederstrand
e way of making non-trivial changes to a model field definition. If you have lots of data to migrate, you may need to optimize the data migration with e.g. raw SQL instead of the naive: for obj in MyModel.objects.all(): obj.my_m2m.add(obj.my_fk) Erik -- You received this message because y

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

2015-06-20 Thread Erik Cederstrand
ly shows > an empty list. > > Any ideas? Post your code? Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@

Re: Django 1.8 Transaction Begin

2015-06-18 Thread Erik Cederstrand
amiliar with transactions on MySQL). Just remember that the only MySQL storage engine that actually supports transactions is InnoDB: https://dev.mysql.com/doc/refman/5.5/en/storage-engines.html Erik -- You received this message because you are subscribed to the Google Groups "Django

Re: Squashed migration

2015-06-12 Thread Erik Cederstrand
t.com/en/1.8/ref/django-admin/#test-app-or-test-identifier> Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr

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

2015-06-09 Thread Erik Cederstrand
t raises Http404 > 3) set Debug=False > 4) create custom '404.html' template > And then you get Server Error Page, instead of 404 page Please create a bug report and attach the code for your test project. That way, it's easier for everyone to reproduce. Erik -- You receiv

Re: heavy refactoring

2015-06-09 Thread Erik Cederstrand
. If not, and you want to rename the tables too, just issue raw "ALTER TABLE name RENAME TO new_name" SQL in an empty migration. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rec

Re: Graph theory ??

2015-06-02 Thread Erik Cederstrand
to Python and run that. You can also have a look at https://www.djangopackages.com/grids/g/trees-and-graphs/ <https://www.djangopackages.com/grids/g/trees-and-graphs/> and see if anything suits your needs. Erik > Den 02/06/2015 kl. 13.47 skrev Rafael E. Ferrero <mailto:rafael.fer

Custom RelatedManager?

2015-05-22 Thread Erik Cederstrand
on Bar. Is there a way to do this? Can I create a custom RelatedManager for 'bars'? I can rewrite it as: Bar.prefetched.filter(mymodels=m, ...) but it feels more awkward. Thanks, Erik -- You received this message because you are subscribed to the Google Groups "Djang

Re: Improve Performance in Admin ManyToMany

2015-05-17 Thread Erik Cederstrand
dvtemporal']: > formfield.queryset = formfield.queryset.select_related('project') > return formfield I just noticed you have a typo: if db_field.name in ['cluster', ... should be: if db_field.name in ['clusters', ... according to yo

Re: Improve Performance in Admin ManyToMany

2015-05-16 Thread Erik Cederstrand
ame.prj_name + ":" + self.data_name Are you sure you don't mean formfield.queryset.select_related('prj_name') If 'prj_name' is the FK on your m2m models, then that's what should be passed to select_related() Django 1.8 should catch this for you, if 'pro

Re: Improve Performance in Admin ManyToMany

2015-05-15 Thread Erik Cederstrand
I guess > I'll remove the call to Project from the __str__ > > I wonder if there is another approach that I can use to solve this? Does the suggestion to append select_related() / prefetch_related() to the queryset in your admin view not work? Erik -- You received this message

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

2015-05-08 Thread Erik Cederstrand
b/transactions/#controlling-transactions-explicitly Especially the third example code in that paragraph shows how to commit some queries while rolling back others. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from thi

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 : > > class Month(models.Model): >year = models.IntegerField() >month = models.PositiveSmallIntegerField() > >def add_months(self, n): >assert n >= 0 >dy, dm = divmod(self.month + n

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

2015-05-04 Thread Erik Cederstrand
bout January 31 (let's ignore for a moment that both PHP and MySQL accept February 31 as a valid date)? Do you want February 28 (or possibly 29), or March 2 (or 3), or possibly 4 weeks ahead? Erik -- You received this message because you are subscribed to the Google Groups "

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

2015-04-21 Thread Erik Cederstrand
lly a Django or Python problem. It's a hard problem to solve in most operating systems, so you may have better luck asking this in a forum related to your operating system. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group.

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 "Djang

Re: how to access manager from a model instance?

2015-03-26 Thread Erik Cederstrand
If you always want to update a value, e.g. increment a counter, you can use an F() expression: https://docs.djangoproject.com/en/1.7/ref/models/queries/#f-expressions If none of these are appropriate, you need to describe your requirements in more detail. Erik -- You received this message

Re: Re-run only tests that failed last time

2015-03-24 Thread Erik Cederstrand
ter, or splitting up your test cases into fast and slow tests, so you can run your slow tests less frequently depending on some setting. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rece

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

2015-03-06 Thread Erik Cederstrand
RL: http://127.0.0.1:8000/de/ > Django Version: 1.7.5 > Exception Type: ImportError > Exception Value: > No module named 'p' Try starting runserver as "python manage.py runserver --traceback" That should get you a traceback when you open the URL in your

Re: django doesnt wait for my time.sleep

2015-03-04 Thread Erik Cederstrand
p(3) so it wait 3 sec while all this happen, > but doesn't respect that =( > > any ideas why that might happen or a workaround? Please post the relevant code. Without that, it's really just quesswork. Erik -- You received this message because you are subscribed to the Go

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 sec

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

2015-02-25 Thread Erik Cederstrand
ype bytes) "obj.__dict__[field]" returns an object that has a __str__ method (format() calls the __str__ method of the object to convert it to a string). The __str__ method should only return unicode data but is returning byte strings. What does "obj.__dict__[field]" return, and

Re: Gunicorn sock file is missing?

2015-02-25 Thread Erik Cederstrand
nicorn_start script instead of just "exec gunicorn". Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
create(), may not work correctly under a different > isolation level) and simply update your locking logic to guard against > that race condition (if the add fails, assume that another process has > grabbed the lock in the interim). Yeah, I think I'll do just that. My production

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
Den 10/02/2015 kl. 21.27 skrev Erik Cederstrand : > > Running this in parallel in two processes on the same machine returns this > after a while: > > Process A: > [...] > > Process B: > [...] > Traceback (most recent call last): > File "tmp.py", l

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
SAVEPOINT "s140735261451008_x1"; args=None 2015-02-10 21:02:25,784 DEBUG(0.000) SELECT cache_key, expires FROM "dispatch_cache" WHERE cache_key = 'foo'; args=['foo'] 2015-02-10 21:02:25,791 DEBUG(0.007) INSERT INTO "dispatch_cache"

Re: Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
> Den 10/02/2015 kl. 17.15 skrev 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' t

Logging transaction statements?

2015-02-10 Thread Erik Cederstrand
statements logged, but I also need 'BEGIN' and 'COMMIT' so I can see when the transaction started and ended. How do I do that? Thanks, Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: Pillow on QPython3

2015-02-03 Thread Erik Cederstrand
chance you'll get helpful answers from this list. Thanks, Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroup

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

2015-01-30 Thread Erik Cederstrand
our use of transactions, whether the data has been submitted from a form etc. You should audit your code for these things if race conditions are a concern to you. Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fro

  1   2   3   4   >