Re: Agricultural and livestock marketplace plus social network as a whole

2024-03-15 Thread Michal Plsek
1/ looking like 100k production product, dont really think this can seriously be deployed by couple of volunteers (even if there is future split of 20%, which is not so much for this kind of job btw) 2/ look if django-oscar has api you could use, it already has 75% of required functionality 3/ or l

Re: ANYONE TO HELP ME ON HOW TO CREATE AN AUTOMATIC NOTIFICATION SYSTEM THAT SENDS A MESSAGE WHENEVER AN OBJECT IS CREATED OR MODIFIED

2023-09-04 Thread Michal Plsek
Just register post_update signal with the Model you want to "watch" to be created/updated, and in optimal case send message to some asynchronous queue, which will take message 15 minutes late and processes it by creating Notification object. For example async queue = aws sqs, they even support 15mi

Curious about ModelAdmin internals.. how the hell does it work

2021-09-01 Thread Michal Plsek
Hello, I would like to know about this (although I hacked around it, but I am still curious): if I have model which contains ForeignKey attribute and I am using autocomplete_fields on it, where is the found FK of foreign object saved on ModelAdmin page? Numerical ID of foreign object represente

Re: How to find out when a fix will be released

2019-09-12 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Wed, Aug 28, 2019 at 01:59:01PM +0800, wd wrote: > > > > As a concrete example, consider a moment in time halfway between the > > release of Django 5.1 and 5.2. At this point in time: > > > >- Features will be added to development master, to b

Writing a text file from Form input

2019-09-08 Thread Michal Pavliš
Hello, so i'm writing a program that uploads invoices to an accounting webapp based on order info from Wordpress. At one point, the code takes an order number, fetches order data using the WP REST API and is supposed to write a .txt file in a specified location containing mentioned order data.

Re: Django security releases issued: 2.2.2, 2.1.9 and 1.11.21

2019-06-03 Thread Michal Petrucha
il: https://www.djangoproject.com/weblog/2019/jun/03/security-releases/ And there's no need to send your reply to all three mailing lists where this release was announced. ;) Michal > On Mon, Jun 3, 2019 at 7:17 PM Carlton Gibson > wrote: > > > Today the Django team issued 2.2.2, 2.1.

Re: Re: Composite Primary / Foreign Key support

2019-02-19 Thread Michal Petrucha
#x27;t help you solve your immediate problem, and I get that it's frustrating. Either way, that's where we are today. Cheers, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJcbBq2AAoJEHA7T/IPM/kl/oQQAIGotHVDPhiD646CZ3hACeqX c0+U9g2fwhDl8yVauh+Ra9B

Re: Composite Primary / Foreign Key support

2019-02-11 Thread Michal Petrucha
ject package in there). Keep in mind that this is an internal API, so it might change without warning. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJcYXniAAoJEHA7T/IPM/kl8EAP/Rzaxqe0bDO6vkxb4/Mmmj5S 62t6Cfm3VqqK6NxYjRXG904jKwDI4HMH1SAs5fdVMh9vf+VBj/S5bcIpQ

Re: Logging of full trace with Debug set to False

2019-01-28 Thread Michal Petrucha
/response had. I don't remember exactly how, and I don't have access to that code base anymore, but I remember that we had to explicitly disable as much of Celery's custom logging as we could in order to get that to work. (Might be that things have improved since then, though.) Go

Re: Logging of full trace with Debug set to False

2019-01-28 Thread Michal Petrucha
e the commercial offering [2]. If you set up sentry as one of the default logging handlers, it will catch all unhandled exceptions, and you'll get a fancy stack trace for each, including the values of local variables in each stack frame. Cheers, Michal [1]: https://github.com/getsen

Re: Questions about MySQL notes in Django docs

2019-01-23 Thread Michal Petrucha
can't answer the rest of your questions, but here's a discussion that might shed some light on this for you (along with the tickets linked from that thread): https://groups.google.com/d/msgid/django-developers/1c8af1c8-23dd-4c79-85ce-9486290ae73f%40googlegroups.com Michal -BEGIN PGP SIGNA

Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Michal Petrucha
: ObjectNotFound: (\Scripts\activate:String) > [], CommandNotFoundException > + FullyQualifiedErrorId : CommandNotFoundException > > PS E:\todo> Hi Aditya, The correct incantation for Powershell is .\Scripts\activate.ps1 The version without any extension, or with .bat, would be correct if you were

Re: No module named django.core.wsgi, Apache+ CentOS

2019-01-16 Thread Michal Petrucha
ill show you the lines you need to insert into your apache config in order to use that build of mod_wsgi. More details are explained at https://pypi.org/project/mod_wsgi/#connecting-into-apache-installation. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAE

Re: Problem with testing on Travis CI

2019-01-16 Thread Michal Petrucha
d they will also make it impossible for you to run migrations in a fresh, empty database. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJcPvvRAAoJEHA7T/IPM/kl4gsP/j2Pyl8YQsUi94saQFnIaEIH sxQ28wm4a5vlfAyKxDDNZqcBBwVq0YPkpflEe5DnmFjQdcsanjZgxt+ejwwONmF

Re: Using the Models from two Different Projects in a single script

2019-01-15 Thread Michal Petrucha
ersion), and then use another management command in the other project to import the exported data (again, either write your own custom importer, or use loaddata, depending on whether you need to transform it in any way). Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBA

Re: migrate failed due to Permission

2019-01-14 Thread Michal Petrucha
lot of information, but those queries that you're executing in module scope should go into functions and methods that you only call when you actually need that data. It would be easier to give you more specific advice if you posted the relevant parts of your code, though. Good luck, Mi

Re: Set default value in field dependant on another model?

2019-01-14 Thread Michal Petrucha
ask your business logic layer for the default number of things to request in a new “Quota” for that specific resource, and then pass that number to your form as the “initial” argument. Cheers, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 i

Re: Can a class which inherits from factory.DjangoModelFactory use Django TestCase asserts?

2019-01-14 Thread Michal Petrucha
ght be thousands of times during one run of your test suite. As I understand it, you want to test your factories, which is a good idea. What I suggest you do is to just write a separate test module for your factories. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1

Re: Creation of database in real time and loading it in the DATABASES variable of Django;

2019-01-08 Thread Michal Petrucha
f of each other, which solve this separation using one Postgres schema per tenant in a single database. Right now the one that appears to be maintained would be https://github.com/tomturner/django-tenants. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJ

Re: how to fix this problem using 2.1.3 version

2018-11-26 Thread Michal Petrucha
On Mon, Nov 26, 2018 at 04:34:42PM +0200, Yavin Aalto Arba wrote: > It's kinda all over the place. > > 1. conventions: > urlpatterns is a list not a tuple > 2. > 'restaurants.views', without include? what's this for? > > 3. You did not close the parenthesis correctly in the second item, here's >

Re: how to fix this problem using 2.1.3 version

2018-11-26 Thread Michal Petrucha
On Mon, Nov 26, 2018 at 02:48:25PM -0800, Abba Haruna wrote: > # from django.conf.urls import patterns, url > from django.conf.urls.static import static > from django.views.generic import ListView > from restaurants.models import Food > from django.conf import settings > > urlpatterns = ('restaura

Re: Update profile on login

2018-11-12 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Fri, Nov 09, 2018 at 08:32:28AM -0800, pastrufazio wrote: > Il giorno venerdì 9 novembre 2018 11:37:23 UTC+1, Michal Petrucha ha > scritto: > > Found it. :) The error lies in the filter() call: > > > > Thank you ver

Re: Update profile on login

2018-11-09 Thread Michal Petrucha
't accept callables. Cheers, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJb5WMVAAoJEHA7T/IPM/klwgkQAJpdDsTNeCFKnmcDpmXPs+S7 vQy+aEyaV3VkfgCpH92n/3Csvad5Fw4cloSef+4DIR1897Hj2x7ga8HA7chcPdJ5 g/mZQNti54ILJMOnWAISD5jPlikec9eibfs06PPSdJnz5O3fcN1hPAy5klWNyED

Re: Update profile on login

2018-11-09 Thread Michal Petrucha
code below > > *TypeError at /admin/login/ int() argument must be a string, a bytes-like > object or a number, not 'ModelBase'* > > Any help would be really appreciated! Hi, Could you please post the full stack trace rather than just the final error message? That would

Re: Need help with CDN on Django App using heroku

2018-10-22 Thread Michal Petrucha
here: https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbze/JAAoJEHA7T/IPM/klbT8QAOLnyQUXGiJWWyXk0p1bEDMN cECp9OkfvZsugvSkubXJF1RppLS9dv4CaPoC2dplC/HjPJeE/4h

Re: Using Primary key in two fields

2018-10-17 Thread Michal Petrucha
o, set primary_key=True on the AutoField, and for icatid, just use unique=True instead. That will tell the database that icatid is a secondary key. Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbxyMqAAoJEHA7T/IPM/klo8AP/i83PGOzi7+rwqc566VqdYT9 DY5SF9Vh/NAhCAxNVaC369yXRr2/L2EE

Re: Form Code getting executed during django project startup

2018-10-12 Thread Michal Petrucha
at runtime, whenever the form is instantiated: class SomeForm(forms.Form): field = forms.ChoiceField(choices=get_choices) Good luck, Michal > > > def get_choices(): > return some choices > > > In views.py, I have imported SomeForm: > > from app.m1 import SomeFo

Re: Alternatives to using __contains?

2018-10-10 Thread Michal Petrucha
's a trade-off worth doing if your only reason is that you don't like the kwargs-based API of relationships, expressions, and filters. Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbvgpYAAoJEHA7T/IPM/klaZkP+wTJ+l3p+DPN/KJPAabMKf95 llom243U4TJ1DhWjr/Ca

Re: how to create, read, update and delete other dependent tables in detail view Django

2018-10-10 Thread Michal Petrucha
to perform CRUD operations on > Dependent and Document table > > Pls can anyone provide th solution > > Thankyou I suggest that you start here: https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#inline-formsets Michal -BEGIN PGP SIGNATURE- Ve

Re: Alternatives to using __contains?

2018-10-10 Thread Michal Petrucha
lationships, expressions, and filters with __ in keyword arguments is how this is done in Django, and it's most likely going to stay that way for the foreseeable future. Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbvb0CAAoJEHA7T/IPM/klndQP/Rd91q/4ANlPzkIzzJd3xRuX xrJ

Re: Django 2.1.1 creating CharField in a Form in Django on a Raspberry pi

2018-10-09 Thread Michal Petrucha
template itself. Honestly, I'm surprised that doesn't raise an error. Regardless, you should remove the spaces around “form”, and then you'll be able to refer to the form as, well, “form” in your template. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEB

Re: "No such table" error, with different tablename as in query

2018-10-08 Thread Michal Petrucha
u have multiple databases defined in your settings, and a router that directs write queries for the Transaction model to the wrong one? Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbu3YYAAoJEHA7T/IPM/klrZ8P/1FAI/sm5UEMOUSnxjLM6fI+ /9Lu7/7ZhFvKFVXOSa6GT2pxEjOkdLmtmM

Re: Not Able to Connect to Vertica

2018-10-04 Thread Michal Petrucha
ven claim to have full ORM support anyway. All in all, it doesn't seem to be feasible to use a Vertica database with Django at this point, at least not with open-source libraries. Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbth25AAoJEHA7T

Re: Running a single version of my Django app but with two databases: one for dev and one for prod

2018-10-03 Thread Michal Petrucha
ach seems like it's more trouble than it's worth, and you'll make your life a lot easier if you just make two separate deployments sitting on separate domains. (A relatively common approach is to use a “dev.” or “staging.” or “beta.” subdomain of your main domain for the dev/testing/st

Re: Geodjango Error

2018-10-01 Thread Michal Petrucha
if you use backslashes as a directory delimiter, make sure to either use a raw string literal (r'c:\path\to\my\gdal.dll'), or double-backslashes ('c:\\path\\to\\my\\gdal.dll'). Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbsxTVAAoJEHA7T/IPM/klLA0QAN

Re: Refer tutorials to make multitenant application with shared database with multiple schma

2018-09-19 Thread Michal Petrucha
Not sure if there's anything like that for mysql. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbojg9AAoJEHA7T/IPM/kljwwP/0kKZ3CwgUl9OxNB2THxcQEJ ioDPkLIiF6HLRHhnBo29wZJX+2ngrh1lMagUZLJ7FpnPCl6IUyf1hmE4WyRU17fn 93ypqt2HLgz5HFKtvcRO5

Re: Recreate all tables in mysql after dropping the database

2018-09-17 Thread Michal Petrucha
, rather than as a magic silver bullet to fix all database problems, and once you have a migration that does what you want it to do, commit it into the revision history of your code base. Good luck, Michal -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJbn1kHAAoJEHA7T/IPM/klAxQQAIR

Re: Contributing to Django

2018-09-06 Thread Michal Petrucha
lved! I'd suggest that a good place to start would be https://docs.djangoproject.com/en/2.1/internals/contributing/ Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving email

Re: Trying to replace a char field with a forgein key feild

2018-08-29 Thread Michal Petrucha
? None of what you wrote suggests that this should in any way fail, as long as operations 1, 2, and 4 are performed with AlterField, AddField, and RemoveField, and you use model classes passed into RunPython through the ``apps`` argument. Could you perhaps provide some more details about the failure t

Re: How to delete least recently used not expired django sessions?

2018-08-20 Thread Michal Petrucha
Django applications, but you can find a bunch of material on this topic. For example, this article seems to consider a lot of potential attack vectors: https://paragonie.com/blog/2015/04/secure-authentication-php-with-long-term-persistence#title.2 Michal -BEGIN PGP SIGNATURE- Version

Re: Django Generic Date Views

2018-08-10 Thread Michal Petrucha
and > they leave out a lot of stuff..like how to access these views.  Maybe that > is something I should know, but don't. > > As it is getting late here I will be taking another look at this tomorrow. Michal [1]: https://docs.djangoproject.com/en/2.1/topics/

Re: Django Generic Date Views

2018-08-09 Thread Michal Petrucha
by iterating over it). So you'd typically just set that as the ``queryset`` attribute on a generic view, and then every time the view is executed, it will take that unevaluated queryset, add all the necessary filters to only select items for today, and then fetch those. Michal

Re: Django Generic Date Views

2018-08-09 Thread Michal Petrucha
n class attributes in your customized subclasses. In this case, all of the generic date views by default look at the ``queryset`` class attribute when they want to read objects from the database, not ``vi``, which is why you'd typically use that name in your subclass. Good luck, Michal -

Re: Model formset not saving

2018-07-18 Thread Michal Petrucha
your literal code, then the form.save() call will definitely return a list – the default implementation of ModelFormSet.save() always does: https://github.com/django/django/blob/stable/2.1.x/django/forms/models.py#L657-L669 As for why nothing is created in the database – are you also updating the

Re: how to programmatically get the index name of a model field on a migration of django 1.8

2018-07-02 Thread Michal Petrucha
ngo that's not past EOL, and use the more explicit support for indices introduced in 1.11, but I have no idea how much easier it would make to solve your problem. (You should consider upgrading regardless, though.) Good luck, Michal -- You received this message because you are subscribed to the

Re: ARGPARSE ERROR

2018-04-13 Thread Michal Petrucha
e to a newer Python; if the latter, then you need to fix your Python installation, and make sure that it includes the entire standard library. Good luck, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gro

Re: single queryset from multiple tables

2017-09-18 Thread Michal Petrucha
build model instances for all of them, and sorts the combined list in memory. Then you'd be taking the result of that sorting routine, and pass that to the paginator, which would discard all but 50 items from the potentially huge list of model instances. I don't think there's a way to n

Re: Dynamically adding a field to a model - via contribute_to_class

2017-09-13 Thread Michal Petrucha
xtension field on the same model, and when eventually the create_model schema operation is executed, it adds each of them as another column to the table, which is obviously wrong. As for what you could do to avoid this situation – I'd suggest that you add an extra argument to PriceField which tel

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
en you might have to investigate if there's perhaps some cached attribute that doesn't get cleared. Good luck, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
caches have already been filled, the new field or relation won't be reflected in them, leading to errors just like yours. There's an internal undocumented API that takes care of this, Model._meta._expire_cache(), which will clear all those caches. It should do the trick for you, but as a

Re: ValueError: Need 2 values to unpack in for loop; got 3 (actually num_loopvars = 2 and len_item = 3)

2017-07-17 Thread Michal Petrucha
... {% endfor %} The problem is that mylist contains triples, not pairs. It would help a lot if you could show the actual template code, as well as the context that you pass to the template. Cheers, Michal -- You received this message because you are subscribed to the Google Groups "

Re: Possible bug - Incorrect escaping in Django SQL query

2017-06-02 Thread Michal Petrucha
of string formatting, so this double-percent escaping appears to be wrong there. I did a quick search through the issue tracker, and didn't find anything about this issue, would you mind submitting a new bug report? It would be best if you could include a complete minimal example that we coul

Re: Generating HDF5 and downloading

2017-05-02 Thread Michal Petrucha
't know a thing about Python, which makes it hard to support file-like Python objects. According to the docs, the “core” file driver with backing_store=False might do the trick, but I don't see how you could then read the byte stream of the in-memory file afterwards. Barring that, you&#

Re: First models.py needs tuning

2017-04-21 Thread Michal Petrucha
, as well as higher-level validation in Python. Cheers, Michal -- 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...@go

Re: First models.py needs tuning

2017-04-21 Thread Michal Petrucha
just add a surrogate primary key field to all your tables and models. Cheers, Michal -- 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+unsub

Re: Let's Encrypt installation fails with WSGI on Ubuntu 14 LTS

2017-03-25 Thread Michal Petrucha
fewer moving parts, there's no risk that the config automagic won't work with the config directives used in your particular config, there's no need to reload the webserver on each run, and in general, I personally distrust any magic that messes with my configuration. Good luck, Mi

Re: How to keep track of online users?

2017-03-03 Thread Michal Petrucha
ield and middleware to update it automatically. > Code > above contains ample hints for you to start digging. Keep in mind that this will only work if you use a model-based session storage; if you use a storage like the signed_cookies session backend, this will not be possible. Cheers, Mi

Re: Django Migrations?

2017-03-02 Thread Michal Petrucha
In this case (and now I'm just guessing, because you haven't provided a lot of detail in your problem description), it might be that you have a broken migration in your repository that you'll need to fix. If that is the case, could you also post the code of the migration file that is fa

Re: "TemplateDoesNotExist at /"

2017-02-25 Thread Michal Petrucha
s the above code, only with a single function call. More often than not, less code is better. Also, unlike TemplateResponse and render, the code above will not apply context processors, unless you change that Context to a RequestContext, which is something that's super easy to forget, and I'

Re: Difference

2017-02-15 Thread Michal Petrucha
beginning with the letter “T”, you'd use the related_query_name in the queryset filter: Reporter.objects.filter(articles_written__title__startswith="T") Does this make it more clear? Cheers, Michal -- You received this message because you are subscribed to the Google Groups &qu

Re: Django allauth, manage redirect

2017-02-07 Thread Michal Petrucha
of the sign-up process or not. Good luck, Michal [1]: https://django-allauth.readthedocs.io/en/latest/advanced.html#custom-redirects -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: Separator between forms in formset factory

2017-01-28 Thread Michal Petrucha
tps://docs.djangoproject.com/en/1.10/_modules/django/forms/formsets/#formset_factory> > . > > Kind regards, > Jeroen Hi Jeroen, Have you considered simply iterating over the individual forms in your template, and including the separator in the for loop? You can fi

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Michal Petrucha
use it imports the views module, which in turn imports models. Just removing the “from . import views” line should let you move forward – unless you also have other imports in the __init__.py file, in which case you can most likely just remove them, too. In general, in an average Django package, there&

Re: models foreign key

2017-01-15 Thread Michal Petrucha
#x27;s not it, then I'm afraid you'll have to provide more details than “it's not working” – what steps did you take exactly, what was the output, what output did you expect, etc. Good luck, Michal > *please help, Thanks. * > > > class *Author*(models.Model): > *

Re: Dynamic Models

2017-01-05 Thread Michal Petrucha
s, with all kinds of field caching, but also things like the way relationship fields are resolved on startup. So even if you put something together that appears to kind of work, expect there to be a lot of corner cases and things that outright won't work. Good luck, Michal -- You receiv

Re: request.read() is empty in POST

2017-01-04 Thread Michal Petrucha
this kind of problems. If trying to read request.body is raising a RawPostDataException on you, complaining that you cannot access body after reading from request's data stream, that means you need to look at any code that's executed before that line and track down what is performing t

Re: Multiple Fields as Primary Key in MySQL - Django 1.10

2017-01-03 Thread Michal Petrucha
ge ORM refactoring and a huge testing > refactoring, let my work hard to maintains. What I understand after the 1.6 > release is that this fe external library. > > As I know Michal Petrucha make a good job on GSoc 2011. > However, I don't know when is in planning the c

Re: validate_email returns None for any or format

2016-12-21 Thread Michal Petrucha
gt; >>> print x > None > >>> > > Shouldn't it be returning True or False? According to https://docs.djangoproject.com/en/1.10/ref/forms/validation/#validators: > A validator is merely a callable object or function that takes a > value and simply retur

Re: Phone number field in form/ model

2016-12-14 Thread Michal Petrucha
docs.io/en/latest/, and take some inspiration from them. Cheers, Michal -- 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...@googlegr

Re: Installing django on python3.5.2. Debian

2016-12-13 Thread Michal Petrucha
s a high chance that you will overwrite some of the essential repository-installed packages with pip, which can render your entire Python installation unusable. This does happen to people quite often, and it's quite difficult to recover from. Good luck, Michal -- You received this message

Re: Extending FieldField (the way ImageField does)

2016-11-20 Thread Michal Petrucha
reField, or a JSONField; on other databases, you can use one of the many JSON field implementations backed by a simple TextField. Option 2 will be easier to implement and maintain than option 3, I think, whereas option 3 is more “pure” in terms of relational database design. Good luck, Michal --

Re: django_admin database creation, after sql command depreciated

2016-11-18 Thread Michal Petrucha
tadmin, but I have appended my > application to the list in my settings.py. I got suspicious that I > need to add my application separately to the installed_apps list. Nothing like that. As you noted above, you are getting the error about a missing table before Django ever gets a chance to start

Re: Setting up jQuery in debian with virtualenv

2016-11-10 Thread Michal Petrucha
jango is concerned, it really does not care where the static file is coming from, as long as you configure your static file finders to see the file. Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from t

Re: External access

2016-11-07 Thread Michal Petrucha
runserver 0.0.0.0:8000 Good luck, Michal -- 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 g

Re: Django1.9 Mongodb support

2016-11-04 Thread Michal Petrucha
ional data stores, and the last time I checked, neither of those projects was maintained anymore. May I ask if you have any specific reason to want to use mongo with Django? If not, you're most likely better off using Postgres instead, which has excellent support in Django. Cheers, Michal --

Re: Redirect after Form

2016-10-31 Thread Michal Petrucha
ny.pk,))) > #return redirect('views.company_detail', pk=company.pk) > > > And it works fine! Just for the record, you should also be able to use this:: return redirect('crm:company_detail', company.pk) (That should be equivalent to the explicit HttpResponseRedirect with

Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Michal Petrucha
Hi Mike, On Fri, Sep 30, 2016 at 06:00:30AM -0700, Stodge wrote: > Thanks Michal, > > The two servers are on the same domain and use different databases. At the > moment I'm using the default Django session backend. > > It's an experiment, nothing more really. I j

Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Michal Petrucha
ays to go about implementing SSO, some of which would be affected by this. You might want to share some more information, such as: - Are those two applications sharing one database? - What session backend are you using? - Are they on the same domain? (this one I've already asked above) - Could you

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 05:17:54AM -0700, Web Architect wrote: > Hi Michal, > > Thanks for your response. My mistake that I should have mentioned that we > are using Django 1.8. The decorator cache_control I think was introduced in > 1.9. Would there be something similar in 1.8

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
es import views from django.views.decorators.cache import cache_control cached_flatpage = cache_control(max_age=4700)(views.flatpage) urlpatterns += [ url(r'^about-us/$', cached_flatpage, {'url': '/about-us/'}, name='about'),

Re: cannot import name SortedDict

2016-09-20 Thread Michal Petrucha
u might have to try restarting it – most of the time, runserver tries to reload itself automatically, but there are pathological cases where it doesn't work). If that doesn't help, try checking if there are any stale leftover .pyc files, and try removing those. Good luck, Michal -- Yo

Re: Random 404 instead of 301 for URLs without trailing slash

2016-09-16 Thread Michal Petrucha
not match any URL pattern. It is possible that you have a catch-all urlpattern that happens to match your URL without a trailing slash, and then raise an explicit 404 – this might happen, for instance, if you're using something like a wiki application, or a custom handler for flatpages, includ

Re: Django exit function

2016-09-10 Thread Michal Petrucha
I haven't been able to extract much useful information at a glance, but you might be able to find something that suits your need. Cheers, Michal [1]: http://docs.gunicorn.org/en/latest/settings.html#on-exit [2]: https://uwsgi-docs.readthedocs.io/en/latest/Hooks.html -- You received this m

Re: How modify Django to set URLs with decorators on the view functions like Flask? (rather than using urls.py)

2016-09-10 Thread Michal Petrucha
arly on and fail immediately, instead of running in a semi-broken state happily without ever telling anyone. Cheers, Michal -- 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

Re: Maintaining old django code

2016-09-06 Thread Michal Petrucha
and the usual “two releases” policy applied. So no, at the very least, when going from 1.4 to 1.8, you should make an intermediate stop at 1.6, but if you want to minimize the pain, going through every single feature release would probably be the best idea. [1]: https://docs.djangoproj

Re: django.core.exceptions.FieldDoesNotExist but the field exists

2016-09-05 Thread Michal Petrucha
tack trace, this error happens when the autodetector is trying to get the model field from a previous state of the models, which is determined from the migration history, not the current model definitions. Have you by any chance made any changes to any of the existing migrations? I can imagine that

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

2016-08-31 Thread Michal Petrucha
use an F() expression in subsequent filters; something like this: A.objects.filter( b__in=B.objects .annotate(max_date_created=Max('a__b__date_created')) .filter(date_created=F('max_date_created'), text='ABCD') ) Good luck, Michal -- You receiv

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Michal Petrucha
http://ccbv.co.uk/, which is an invaluable resource whenever you're doing anything with CBVs that involves more than setting the ``template_name`` and ``model`` attributes. In my opinion, CCBV makes a lot of the pain involved in dealing with CBVs go away. Cheers, Michal -- You received this

Re: Starting new project -- version 1.10

2016-08-23 Thread Michal Petrucha
tproject. I hope this explanation makes sense, and feel free to ask if there's anything unclear. Cheers, Michal -- 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,

Re: receiving PNG file in django

2016-08-22 Thread Michal Petrucha
On Mon, Aug 22, 2016 at 11:10:38AM -0400, Larry Martell wrote: > On Mon, Aug 22, 2016 at 11:00 AM, Michal Petrucha > wrote: > > On Mon, Aug 22, 2016 at 10:11:49AM -0400, Larry Martell wrote: > >> When I get the request, request.FILES is empty. Yet the content type > >&

Re: receiving PNG file in django

2016-08-22 Thread Michal Petrucha
reversible, performing a Unicode normalization, and then throwing away everything non-ASCII would most certainly not be the correct way, since it would mangle about one half of the input data into ASCII. > Any suggestions on how I can make this work? You'll have to make sure that the request

Re: Starting new project -- version 1.10

2016-08-22 Thread Michal Petrucha
all you have to do is create a models.py file in there (next to the existing urls.py, if you need any models), views.py (if you need views), and add 'crm' to ``INSTALLED_APPS``. That's pretty much the same thing as what startapp would have done, anyway. Good luck, Michal -- You rece

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
On Fri, Aug 19, 2016 at 02:38:02PM +0200, Michal Petrucha wrote: > On Fri, Aug 19, 2016 at 05:02:39AM -0700, bobhaugen wrote: > > On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: > > These questions remain unanswered, although I intend to do a bunch mo

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
On Fri, Aug 19, 2016 at 05:02:39AM -0700, bobhaugen wrote: > On Friday, August 19, 2016 at 5:20:45 AM UTC-5, Michal Petrucha wrote: > > > > Could you show us the code of with_user? Maybe it does not return an > > unevaluated queryset? > > > > > def w

Re: Odd problem: some database updates do not appear on other pages until server restart

2016-08-19 Thread Michal Petrucha
s.Manager) Could you show us the code of with_user? Maybe it does not return an unevaluated queryset? Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
tication, maybe even something based on OAuth, or perhaps JWT. The Django REST framework, for example, gives you many options, both built-in, as well as popular third-party extensions. Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users&quo

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
g a sniffing proxy or some other tool, and just making the request directly? Cheers, Michal -- 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+u

Re: Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread Michal Petrucha
the default formfield; in that case, you'd need to have both model fields and form fields in the same module, and it would be quite chaotic and unclear which one you're referring to if you cherry-picked classes to import instead of just importing the modules. Cheers, Michal --

Re: django 1.9, migrations certainly don't suck

2016-07-29 Thread Michal Petrucha
On Fri, Jul 29, 2016 at 08:01:05AM -0700, Jorge Cadena wrote: > > > Traceback (most recent call last): > File "manage.py", line 10, in > execute_from_command_line(sys.argv) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 353, in execute_from

Re: django 1.9, migrations SUCK

2016-07-29 Thread Michal Petrucha
ewhere at module level you are making database queries). If that is indeed the case, then you would get the exact same error even with the old syncdb. However, it is hard to tell for sure, since you have not provided the full traceback. Cheers, Michal -- You received this message because you

  1   2   3   >