Re: Testing an app without a models.py file

2012-04-22 Thread Michal Petrucha
On Sat, Apr 21, 2012 at 10:25:20PM -0700, dor wrote: > As of the latest version (1.4), this is impossible. What's the > rationale behind it? Why isn't it fixed by now? If I make a fix, > will it be accepted by the official team? It is caused by the way Django loads and registers apps. Currently it

Re: scroll to form on error

2012-05-12 Thread Michal Petrucha
On Sat, May 12, 2012 at 07:51:01AM -0700, brian wrote: > The redirect method isn't working. I use middleware to insert a form > into the context for each page. When I try to redirect with a > fragment identifier, then the page scrolls but I don't see the form > errors. If I remove the error form

Re: bash error when trying to django_admin.py; not found -- FAQ not helping

2012-05-20 Thread Michal Petrucha
On Sun, May 20, 2012 at 02:08:14AM -0700, Mike Manfrin wrote: > Holy moly. > > Turns out I was typing django_admin.py when I needed to type django- > admin.py. > > I am feeling a terribly strange mix of relief and stupidity right > now. Just a quick tip, to avoid such mistakes in the future, try

Re: Composite OneToOneFields in Django?

2011-09-19 Thread Michal Petrucha
On Fri, Sep 16, 2011 at 11:28:33AM +0100, Tom Evans wrote: > On Thu, Sep 15, 2011 at 5:02 PM, RedBaron wrote: > > I am fairly new to Django and I think I pretty much get the basic idea > > of ORM. However, there is a peculiar situation to which I do not see a > > plausible solution. I have a legac

Re: Subclassing the ForeignKey field type

2011-09-19 Thread Michal Petrucha
On Thu, Sep 15, 2011 at 09:43:57AM -0700, Tobia Conforto wrote: > Hi all > > I'm adding an XML mapping feature to Django db models. > > The idea is to add as little XML mapping information as possible to existing > models (such as: which fields get mapped to XML, what is their XPath...) in > or

Re: Custom model field/form: __init__() got multiple values for keyword argument 'baz'

2011-09-20 Thread Michal Petrucha
On Tue, Sep 20, 2011 at 10:38:15AM -0700, mhulse wrote: > Hello, > > The problematic code can be found here: > > > > TypeError: > > __init__() got multiple values for keyword argument 'baz' > > I have spent the last couple days trying to figure out how to pass

Re: Custom model field/form: __init__() got multiple values for keyword argument 'baz'

2011-09-21 Thread Michal Petrucha
On Tue, Sep 20, 2011 at 04:18:28PM -0700, Micky Hulse wrote: > Optimally, I think I would prefer to keep the verbose name in the > first position (as an arg, not kwarg) in order to keep things > consistent. > > If you look at fields.py: > > > > Li

Re: How to do equivalent of LEFT JOIN ON in Django (returning all Left rows, when Right item may not exist)

2011-10-08 Thread Michal Petrucha
On Thu, Oct 06, 2011 at 12:05:09PM -0700, Attempting Django wrote: > Hi guys, can anyone please give me an example of how to do equivalent > of a LEFT JOIN ON in Django?? I am trying to return every row from one > table on the left, with any matches in a foreign table on the right > (there will be

Re: Filtering generic relation with additional field

2011-11-09 Thread Michal Petrucha
On Fri, Nov 04, 2011 at 11:03:35AM -0700, guardbadger wrote: > Hi all, > > Appreciate some help trying to build a queryset. Im hoping I can make > this in django, without having to crack open raw sql... Here is my > setup: > > class Container(models.Model): > permissions = generic.GenericRelati

Re: Inserting csrf-token in a form generated by a templatetag?

2011-05-08 Thread Michal Petrucha
tag you'll have to resolve the context variable 'csrf_token' using django.template.Variable.resolve() and then include an with its value. Michal Petrucha signature.asc Description: Digital signature

Re: class based views

2011-05-12 Thread Michal Petrucha
can find it for example via the 1.3 release notes: http://docs.djangoproject.com/en/dev/topics/generic-views-migration/ Michal Petrucha signature.asc Description: Digital signature

Re: Django Admin site and password field

2011-05-12 Thread Michal Petrucha
I don't know if I guessed right but I hope it was at least a little bit useful. Michal Petrucha signature.asc Description: Digital signature

Re: Django Admin site and password field

2011-05-12 Thread Michal Petrucha
On Thu, May 12, 2011 at 09:51:24AM -0700, Gabe wrote: > First of all thx for all replies. > > For now I don`t use auth.User model I would like to create my own. So > I have written model class Users: > > [...] > > Then I have registered it in admin panel by editing admin.py among > with another

Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread Michal Petrucha
On Thu, May 12, 2011 at 08:15:59PM -0700, robinne wrote: > How can I render dynamic content in a base template if I only call a > view on my child template? > > What I am trying to do is setup a base template that will include > "Profile" information for the user who is logged in, for example: > "

Re: Custom Managers and Q() Objects

2011-05-16 Thread Michal Petrucha
On Mon, May 16, 2011 at 08:48:45PM +0200, Marc Aymerich wrote: > Hi, > my question is, How can I define a custom manager that can handle Q > objects? The important thing to realize here is that the default managers proxy all get, filter and other QuerySet calls to a QuerySet that they store, usual

Re: Custom Managers and Q() Objects

2011-05-16 Thread Michal Petrucha
On Mon, May 16, 2011 at 09:58:40PM +0200, Marc Aymerich wrote: > Hi Swawm. > Thanks for your answer. > > when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date) | > Q(ini=other_date, fin=other_date))) I get This error: > > > active_during() takes exactly 3 arguments (2 given) >

Re: How to register JS event handler

2011-05-17 Thread Michal Petrucha
On Tue, May 17, 2011 at 12:34:05PM +0200, Thomas Guettler wrote: > Hi, > > I want to register some jquery event handler for some widgets of a form > (FooForm). The > form gets used in several views. > > It would be a pain to insert $(function(){...}) in every page which uses this > form. > > T

Re: Custom Managers and Q() Objects

2011-05-17 Thread Michal Petrucha
On Mon, May 16, 2011 at 11:54:14PM +0200, Marc Aymerich wrote: > > > when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date) > > | > > > Q(ini=other_date, fin=other_date))) I get This error: > > > > > > > > > active_during() takes exactly 3 arguments (2 given) > > Hi Michal, > Ye

Re: confused over use of XYZ.objects.get() method

2011-06-05 Thread Michal Petrucha
On Sat, Jun 04, 2011 at 09:01:36PM -0500, Javier Guerra Giraldez wrote: > I have never seen that usage of Meta. where is it documented? I'd say such usage would fail, see https://code.djangoproject.com/browser/django/trunk/django/db/models/options.py#L96 All in all, adding custom attributes to Me

Re: confused over use of XYZ.objects.get() method

2011-06-05 Thread Michal Petrucha
On Sat, Jun 04, 2011 at 12:21:37PM -0700, Ryan wrote: > Right, if what you have typed in your post is the code you are actually > trying to use, there are two problems that jump out at me. > > The first is that *question = models.CaaQuestion(pk=210) *will actually > create a new question with th

Re: Confused about uploading files (Cannot force both insert and updating in model saving)

2011-06-06 Thread Michal Petrucha
On Sun, Jun 05, 2011 at 07:18:24PM -0700, Roy Smith wrote: > I'm trying to figure out how to upload a file. I've got a model that > looks like: > > class DataSet(models.Model): > file = models.FileField(upload_to='data/%Y/%m/%d') > > and my view method is: > > def create_data_set(request):

Re: admin search - lookup following GenericForeignKey

2011-06-28 Thread Michal Petrucha
> I have a model X with Y field which is GenericForeignKey field. In the > model admin for model X I want to have something like: > search_fields('Y__fieldname'). I get the error 'Cannot resolve keyword > "X" into field' which makes sense since it's a virtual field and > doesn't go to fields in X._

Re: Weird join conditions

2011-06-30 Thread Michal Petrucha
On Thu, Jun 30, 2011 at 08:19:36AM -0700, peroksid wrote: > Hi. > > Queryset attribute query has method join() which allows to explicitly > make JOINs. First argument passed to this method is a tuple of left > table, right table, left column and right column, and rest of > arguments define if we h

Re: Weird join conditions

2011-06-30 Thread Michal Petrucha
On Thu, Jun 30, 2011 at 02:13:05PM -0700, peroksid wrote: > Thank you, Michal, > > Unfortunately, I need join condition, not a WHERE clause, which can be > easily extended with extra() method arguments. > It is not my bad mood, simply the same condition in WHERE and ON > produces different effect.

Re: Weird join conditions

2011-07-01 Thread Michal Petrucha
> Example, yes. As Haroon said, it is LEFT OUTER JOIN. Yeah, of course, must have been the lack of caffeine as I said. (-: > Unfortunately, join and friends are off use because SQLCompiler's > get_from_clause() creates join conditions on dumb string template. > I monkeypatched compiler's get_fro

Re: Limiting the address space of any other binary..?

2011-07-08 Thread Michal Petrucha
On Fri, Jul 08, 2011 at 02:43:11PM +0100, Cal Leeming [Simplicity Media Ltd] wrote: > Sorry, I should have given a bit more detail. > > Using ulimit is going to be an issue as it relies on the host allowing > users to modify their ulimit (some aren't allowed). It also then > applies that rule to

Re: Getting a subclass from an abstract Model

2011-07-11 Thread Michal Petrucha
On Fri, Jul 08, 2011 at 09:02:06AM -0700, gontran wrote: > Hello everyone, > > > my models are defined like this: > > class MyBaseModel(models.Model): > . > class Meta: > abstract = True > > class ClassA(MyBaseModel): > .. > > class ClassB(MyBaseModel): > ..

Re: Managing objects spred among several tables/databases.

2011-07-14 Thread Michal Petrucha
On Thu, Jul 14, 2011 at 06:00:38AM -0700, Hummingbird wrote: > Table names (field names) are are under-- > > customer (custid, custname, groupid), > custdetl (custid, address, tel, mobile, city) > group (groupid, groupname) > > There is a single form for handling tables "customer" and "custdetl"

Re: Managing objects spred among several tables/databases.

2011-07-14 Thread Michal Petrucha
On Thu, Jul 14, 2011 at 07:20:12AM -0700, Hummingbird wrote: > Maybe, I didn't explain the condition properely. > > As you say, in this case, > "UPDATE custdetl SET tel = NULL, address = , CITY = city> > WHERE custid = " > is fine in this simplified version. > > Suppose when a user removes addre

Re: data not validating after image field added to model form

2011-07-17 Thread Michal Petrucha
On Sun, Jul 17, 2011 at 01:19:59AM -0700, sq1020 wrote: > I just added am image field to a model form but when I try to upload > an image using the form, it gives me the following error saying that > the data could not be validated. I don't understand though, what is > it about the image that coul

Re: ManyToMany to_field through and db_table questions

2011-08-08 Thread Michal Petrucha
On Mon, Aug 08, 2011 at 06:28:59PM +1000, Mike Dewhirst wrote: > Can anyone tell me if to_field is valid in this context and what is > the distinction between through and db_table? ... > > class Sections(models.Model): > """ intermediary table for Document recursive m2m """ > document = mo

Re: same form model with separate admins and data

2011-08-09 Thread Michal Petrucha
On Tue, Aug 09, 2011 at 08:53:07AM -0700, brian wrote: > I've created a form with Model->ModelForm flow. Django is running on > a sub-domain and I'm putting separate instances of the form on > multiple php websites via iframe. > > How can I use the same form model but have independent forms? > >

Re: spam in response to posting to this list

2011-08-10 Thread Michal Petrucha
On Thu, Aug 11, 2011 at 12:14:37AM +0300, Praveen Krishna R wrote: > *+1 > * > On Wed, Aug 10, 2011 at 7:32 PM, Kayode Odeyemi wrote: > > > I have been getting this too. Please, people, be at least a little bit reasonable. Let's not make this another completely pointless "+1, me too" thread with

Re: SQL generated for ManyToManyField is incorrect with Django 1.2.1

2011-03-07 Thread Michal Petrucha
says that you have to rearrange your model definitions so that they reference existing ones. If you try to reference a model defined later, you'll get errors while importing the models.py file. Michal Petrucha signature.asc Description: Digital signature

Re: Admin list delete and model delete() method

2011-03-08 Thread Michal Petrucha
sn't called for each element, instead a more direct SQL query is issued to delete all matching objects at once. If you want to circumvent this, I recommend reading through http://docs.djangoproject.com/en/1.2/topics/db/queries/#deleting-objects Michal Petrucha signature.asc Description: Digital signature

Re: Django models and inheritance

2011-03-11 Thread Michal Petrucha
ta. http://docs.djangoproject.com/en/1.2/ref/models/options/#abstract http://docs.djangoproject.com/en/1.2/topics/db/models/#abstract-base-classes That way your abstract class can inherit models.Model and will have no database table created. Michal Petrucha signature.asc Description: Digital signature

Re: file upload size problem

2011-03-16 Thread Michal Petrucha
(i. e. an infinite amount of data). Would you want the server to suck it all in and then give an error message saying that the limit has been exceeded? Michal Petrucha signature.asc Description: Digital signature

Re: ARGPARSE ERROR

2018-04-13 Thread Michal Petrucha
On Thu, Apr 12, 2018 at 07:58:08PM +, Ankush Sharma wrote: > Hi Babatunde , > I installed other listed tools ! Here the main concern im talking about is > Argsparse - > the Progressbar2 3.6.2 requires argparse, which is not installed. > Thanks in advance > Ank What version of Python are you ru

Re: Django not adding / to end of URLS and since urls.py expects /, I now get 404s. How fix?

2016-04-23 Thread Michal Petrucha
On Sat, Apr 23, 2016 at 11:50:05AM -0700, Chris Seberino wrote: > I am trying to be consistent and make urls.py expect / after every url. > > The problem is Django isn't automatically adding / at the end and so now > I get 404s when I try to access my web pages. > > How fix? https://docs.djang

Re: FieldError: Invalid order_by arguments: ['- pub_date']

2016-04-25 Thread Michal Petrucha
On Mon, Apr 25, 2016 at 03:28:27AM -0700, gu99r...@student.chalmers.se wrote: > I'm following the tutorials on the Django website and now I'm stuck at > tutorial 3. I'm working on the 'polls' application. > > The view.py file looks like so > > from django.http import HttpResponse > from django.t

Re: FieldError: Invalid order_by arguments: ['- pub_date']

2016-04-25 Thread Michal Petrucha
On Mon, Apr 25, 2016 at 04:17:08AM -0700, gu99r...@student.chalmers.se wrote: > Yes, that worked. Someone better fix that mistake in the tutorial. I looked at the tutorial, but I didn't find any code example that would contain an order_by call containing a space after the minus sign. If there is s

Re: FieldError: Invalid order_by arguments: ['- pub_date']

2016-04-26 Thread Michal Petrucha
On Mon, Apr 25, 2016 at 08:49:47AM -0700, gu99r...@student.chalmers.se wrote: > Ok, I looked at the tutorial page more closely. When you look at the code, > it looks like there is a space after the minus sign, especially when you > mark text. But if I copy and paste the text into some arbitrary t

Re: Django apparently can't handle that error.

2016-04-26 Thread Michal Petrucha
On Tue, Apr 26, 2016 at 10:02:32AM -0700, Neto wrote: > The right is just Account.objects.last().delete() to delete everything > related to account. > My project has many models related to account, and everything has log, is > unfeasible be deleting the rows of each model to the end delete the ac

Re: Django apparently can't handle that error.

2016-04-26 Thread Michal Petrucha
On Tue, Apr 26, 2016 at 08:17:40PM +0200, Michal Petrucha wrote: > Have you considered altering the table for Log to include an ON DELETE > CASCADE clause instead? That would make the error go away without too > much effort, even though I still think the behavior you are > implementi

Re: Csrf: when is it updated/generated?

2016-04-28 Thread Michal Petrucha
On Thu, Apr 28, 2016 at 12:16:10PM -0700, Stefano Tranquillini wrote: > it says "A CSRF cookie that is set to a random value (a session independent > nonce, as it is called)," and later "For security reasons, the value of > the CSRF cookie is changed each time a user logs in." > > The value is

Re: Add id to url after login user

2016-04-29 Thread Michal Petrucha
On Fri, Apr 29, 2016 at 12:36:30AM -0700, Dariusz Mysior wrote: > I use FormView do login user, but I don't know how I should add his ID > number to success url that when he will log in adres will be > users/profile/id > > urls.py > > from users.views import RegisterView, LoginView, ProfileView

Re: Add id to url after login user

2016-04-29 Thread Michal Petrucha
lutions I described in my previous email? (Quoted below.) On Fri, Apr 29, 2016 at 10:03:15AM +0200, Michal Petrucha wrote: > personally, I'd set up an additional view with a URL pattern of > '^profile/$' that would just get the current logged-in user, and > return a redirec

Re: Add id to url after login user

2016-04-29 Thread Michal Petrucha
On Fri, Apr 29, 2016 at 07:18:28AM -0700, Dariusz Mysior wrote: > Hej ja po angielsku słabo piszę, chciałem się nauczyć Class Based View i na > tym zrobić system rejestracji, masz pomysł jak to dalej zrobić? Chciałbym > wyciagnąć pk i dodać do adresu succes_url... Heh, Michal, nie Michał. (-: O 

Re: Add id to url after login user

2016-04-30 Thread Michal Petrucha
On Fri, Apr 29, 2016 at 12:06:02PM -0700, Dariusz Mysior wrote: > Sory I thought that You are from Poland like I :) > > Hmm I try Your code but there is comment > > name 'request' is not defined It's hard to tell what's wrong without seeing the full traceback that you get with that error; could

Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-05-02 Thread Michal Petrucha
On Mon, May 02, 2016 at 08:37:43AM -0700, Bruce Whealton wrote: > I'm not sure if it is ok to use python manage.py makemigrations on the > production server or if one should just do that locally and then import it. Hi Bruce, Migrations are a part of your application's code base, and they should

Re: makemigrations throws table does not exist error

2016-05-03 Thread Michal Petrucha
On Mon, May 02, 2016 at 02:01:24PM -0700, Lucian Willoughby wrote: > I am trying to re-create an older project from a git repository. I do not > have the original MySql database. I emptied the migration folders and tried > to run "python manage.py makemigrations" which resulted in the following

Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-05-03 Thread Michal Petrucha
Hi Bruce, On Mon, May 02, 2016 at 02:31:37PM -0700, Bruce Whealton wrote: > Michal, >I had to read your response a few times but I finally got it. I was > reading > that all migrations are created in development only and then applied during > production. > So, during development you u

Re: Delete all migration files

2016-05-12 Thread Michal Petrucha
On Thu, May 12, 2016 at 08:11:42PM -0700, Noumia Ngangoum wrote: > Yeah Eugene, I know that, that's how I do now. > I was looking for a one-liner command or something. There is no one-liner, because you are not supposed to remove all migrations. The entire point of migrations is that once you crat

Re: django.contrib apps migrations

2016-05-12 Thread Michal Petrucha
On Thu, May 12, 2016 at 04:55:46PM -0700, Sean McKinley wrote: > Django 1.7+ noob here. Are you supposed to to track the migrations > performed within the django.contrib apps? How do you deploy to production > on a different machine without grabbing these migrations from the django > installatio

Re: south migration: renaming foreign key and m2m tables

2016-05-13 Thread Michal Petrucha
On Thu, May 12, 2016 at 11:46:35PM -0700, schaf...@gmail.com wrote: > HI All, > I'm new in south and I'm wondering how I can merge two models into one. Hi Marcel, If you are using South, that would mean you're using a version of Django that's oldee than 1.7, which means you are using a version th

Re: south migration: renaming foreign key and m2m tables

2016-05-15 Thread Michal Petrucha
On Fri, May 13, 2016 at 01:37:43AM -0700, schaf...@gmail.com wrote: > HI Michal > > I would suggest that you do this the other way around; instead of > > merging Media into Book, I'd merge Book into Media, drop Book, and > > rename Media to Book. Since you're using multi-table inheritance, the

Re: django.contrib apps migrations

2016-05-15 Thread Michal Petrucha
On Fri, May 13, 2016 at 01:01:22PM -0700, McKinley wrote: > Hi Michal, > > I know the django.contrib migrations reside within my virtualenv. What if I > wanted a fellow developer to have access to these migrations without > sharing the same django install. If i have a colleague working on their

Re: FieldError: Cannot resolve keyword u'domain' into field. Choices are: children, content, date_create, date_update, domain__associations, id, level, lft, name, parent, parent_id, rght, tree_id, use

2016-05-17 Thread Michal Petrucha
On Tue, May 17, 2016 at 05:44:24AM -0700, François GUÉRIN wrote: > Hi all, > > I'm a django application dev for a few years, so I'm pretty familiar with > it. I have a problem with a new django 1.9.6 application. I'm writing a > directory app, with a main model named "Association", which have 4

Re: FieldError: Cannot resolve keyword u'domain' into field. Choices are: children, content, date_create, date_update, domain__associations, id, level, lft, name, parent, parent_id, rght, tree_id, use

2016-05-17 Thread Michal Petrucha
On Tue, May 17, 2016 at 05:58:51AM -0700, François GUÉRIN wrote: > Thanks very very very much ! You're welcome. (-: On Tue, May 17, 2016 at 05:56:23AM -0700, François GUÉRIN wrote: > Argh !! It works ! We could use double underscores in relation names, > before, no ? I don't think so – if it ev

Re: Django API CSRF Issues - Need Help

2016-05-21 Thread Michal Petrucha
On Sat, May 21, 2016 at 08:55:04AM -0700, Chris Troutner wrote: > Yep, no luck. I got the cookie plugin integrated, but it didn't make any > difference. The problem isn't with the *retrieval* of the CSRF token, it's > with the *submission*. > > If you bring up this code: > https://github.com/chris

Re: CSS question for the Admin

2016-06-02 Thread Michal Petrucha
On Thu, Jun 02, 2016 at 07:22:16PM +1000, Mike Dewhirst wrote: > I have a varchar field of 300+ chars and I'd like to know how to provide > space to wrap it on screen without resorting to a TextField > > Any CSS ideas? > > Thanks > > Mike Perhaps you could override the widget to a Textarea with

Re: authenticate a user without databse

2016-06-07 Thread Michal Petrucha
On Tue, Jun 07, 2016 at 01:44:29PM -0700, Daniel Wilcox wrote: > Two options: > > 1. Tie into Django Authentication > > You can make a custom authentication backend and do whatever you want for > authentication -- including talk over a named pipe and get the OK for users > if you like. > > With

Re: Non Ascii character in upload file crash in python 3

2016-06-08 Thread Michal Petrucha
On Wed, Jun 08, 2016 at 02:13:23AM -0600, Luis Zárate wrote: > I am using supervisor and gunicorn for production run as fondomutual user. > > $ env | grep LANG > LANG=es_CR.UTF-8 > LANGUAGE=es_CR:es Are you certain that when supervisord is started by init/systemd/upstart, it is also launched with

Re: Custom Database Connector Based on psycopg2 for External Postgres DB

2016-06-09 Thread Michal Petrucha
On Wed, Jun 08, 2016 at 06:14:44PM -0700, Brandon wrote: > Hi! I am attempting to create my own database connector for Django for an > external PostgreSQL DB that I have running. For this application, I issue > the SQL queries and get responses over a REST API, so in theory, I'd like > to adopt

Re: running devel server in docker container

2016-06-28 Thread Michal Petrucha
On Tue, Jun 28, 2016 at 05:01:20PM -0400, Larry Martell wrote: > I am trying to run the devel server in a docker container. On the > physical machine I don't have port 8000 available and I usually use > 8006 for the devel server. Outside of the docker container I can > connect to 8006. Inside the c

Re: Contribute to Django - Python 3 or Python 2

2016-07-02 Thread Michal Petrucha
On Sat, Jul 02, 2016 at 07:04:31AM -0700, premdjango wrote: > Tim - > The reason I said its used in most of the places is because - > > for example: > > pip install -e /path/to/your/local/clone/django/ > > > I would expect pip3 install of pip.. This looks like a bit of a misunderstanding. Us

Re: How can I change the TabularInline "title" on Django Admin?

2016-07-07 Thread Michal Petrucha
On Thu, Jul 07, 2016 at 01:56:08PM -0300, Fellipe Henrique wrote: > Hello, > > When we need to use TabulerInline on Django Admin, the admin template > create a "title" for the field... it's not the verbose_name... verbose_name > is set like a Group.. "Blue" line before TabularInline... after this

Re: How can I change the TabularInline "title" on Django Admin?

2016-07-07 Thread Michal Petrucha
On Thu, Jul 07, 2016 at 03:29:00PM -0300, Fellipe Henrique wrote: > On Thu, Jul 7, 2016 at 2:57 PM, Michal Petrucha < > michal.petru...@konk.org> wrote: > > > Maybe you're referring to verbose_name_plural? > > > > Unfortunately no.. :( > > Her

Re: Hebrew in Raw Query Like Clause

2016-07-08 Thread Michal Petrucha
On Thu, Jul 07, 2016 at 11:23:21PM -0500, Art Zemon wrote: > Hello, > > I have a column in a table that contains Hebrew text. I need to do a query > with a LIKE clause on the Hebrew text. The query works if I execute the SQL > directly, either in a SQL window of phpMyAdmin or in a command line mys

Re: how should i make a non downloadable image in my django website

2016-07-09 Thread Michal Petrucha
On Sat, Jul 09, 2016 at 12:24:25PM +0200, ludovic coues wrote: > If the image is displayed, the user can use a screen capture tool to get it. > > You can make it harder for your user to get the image by putting a > transparent image on top of the displayed image. You can put the image > as a backg

Re: Error in testing script

2016-07-10 Thread Michal Petrucha
On Sun, Jul 10, 2016 at 02:25:40PM -0700, Gary Roach wrote: > On 07/10/2016 01:57 PM, Gary Roach wrote: > >Hi all; > > > >OS Debian Linux KDE desktop > >Django 1.9 > >Python 3.5 > > > >Working with tutorial > >https://docs.djangoproject.com/en/1.9/intro/tutorial05/ > >Writing polls/tests.py script

Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Michal Petrucha
On Tue, Jul 12, 2016 at 12:40:11AM -0700, Malik Rumi wrote: > UPDATE: > > I got it back to where runserver comes up and I get no errors, but the > staticfiles are still not being served. > > > The paths are in the right *format* to satisfy the STATICFILES_DIR in > SETTINGS, and so that they c

Re: static files suspicious operation, os error, and list of paths

2016-07-13 Thread Michal Petrucha
On Tue, Jul 12, 2016 at 02:36:41PM -0700, Malik Rumi wrote: > Michal, > > > , it looks like somewhere, you're calling ``os.path.join(a, b)``, where > the second argument starts with a slash > > I've tried it both ways. The way I got findstatic to work was by taking off > the leading slash, but so

Re: django 1.9, migrations SUCK

2016-07-29 Thread Michal Petrucha
On Fri, Jul 29, 2016 at 07:02:44AM -0700, Jorge Cadena wrote: > Hi, > > I am dev in django at last 4 years, i missed ./manage.py syncdb, > > Delete all tables from databases (MariaDB, PostgreSQL) command line from > DB, and run python manage.py migrate always same error > > *python manage.py m

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: Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 05:09:37AM -0700, graeme wrote: > I have always imported models, and then: > > class Foo(models.Model): > bar = models.CharField(max_length=100) > > > which is what the examples in the django docs do - I copied it when I > started using Django and the habit stuck. >

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 12:17:38PM -0400, Larry Martell wrote: > I have a view that is accessed both from the browser and from a > non-browser app. The request from the non browser app come from a > remote app where the user has already had to login (or they would > never get to the point where the

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 10:12:53PM +0200, ludovic coues wrote: > The session cookie ? > > Or you could use another decorator or a middle-ware doing > authentication based on the ip and some information passed as get > argument. Like a token returned by django when you auth the user. Using the IP

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

2016-08-19 Thread Michal Petrucha
On Thu, Aug 18, 2016 at 11:57:40AM -0700, bobhaugen wrote: > On Thursday, August 18, 2016 at 1:34:29 PM UTC-5, Tim Graham wrote: > > > > I'd guess you're doing a query for the form field's choices at the module > > level which will be executed once and cached for as long as the server > > runs. S

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
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: Starting new project -- version 1.10

2016-08-22 Thread Michal Petrucha
On Fri, Aug 19, 2016 at 02:05:18PM -0700, Rich Shepard wrote: > On Fri, 19 Aug 2016, Tim Graham wrote: > > >Don't use the same name for your app and project. When you "startproject > >crm", the project settings.py, urls.py, and wsgi.py are placed in a module > >named "crm" so you can't use the sam

Re: receiving PNG file in django

2016-08-22 Thread Michal Petrucha
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 > is multipart/form-data and the method is POST: > > (Pdb) print request.META['CONTENT_TYPE'] > multipart/form-data; > boundary="boundary_.oOo._NzEwNjIzMTM4MTI4NjUx

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: Starting new project -- version 1.10

2016-08-23 Thread Michal Petrucha
On Mon, Aug 22, 2016 at 07:48:44AM -0700, Rich Shepard wrote: > One clarification on projects vs applications will help my learning. > Rather than using the same name for both (based on prior advice), the > project name is clientmanagment and that directory contains > clientmanagement/ crm

Re: Attribute error, with a very basic banking app

2016-08-26 Thread Michal Petrucha
On Fri, Aug 26, 2016 at 10:29:16AM -0400, Andromeda Yelton wrote: > In my experience, CBVs are useful when the view you want to write is > basically a create, read, update, or delete operation on a single database > item, or a bunch of instances of the same model (...and it turns out a lot > of web

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

2016-08-31 Thread Michal Petrucha
On Tue, Aug 30, 2016 at 11:46:14PM -0700, Web Architect wrote: > Hi Erik, > > I tried your solution but there are some issues: > > .filter(date_created=Max('a__b__date_created')) - this is throwing error > saying not proper use of group function. > > If I remove the above, the result isn't cor

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

2016-09-05 Thread Michal Petrucha
On Mon, Sep 05, 2016 at 08:44:55AM -0700, Stefano Tranquillini wrote: > Hello > > I've a problem syncing the db. > > I run the command: django-admin migrate > > System check identified some issues: > Operations to perform: > Synchronize unmigrated apps: oauth2_provider, > Apply all migratio

Re: Maintaining old django code

2016-09-06 Thread Michal Petrucha
On Tue, Sep 06, 2016 at 11:12:14AM +0200, Andreas Kuhne wrote: > 2016-09-06 10:57 GMT+02:00 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

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
On Fri, Sep 09, 2016 at 10:11:25PM -0700, Chris Seberino wrote: > Flask has a neat design where instead of having a urls.py file they bind > URLs to view functions with decorators. > > Possible to do something similar with Django? What modifications would be > needed? Personally, I'm not a big

Re: Django exit function

2016-09-10 Thread Michal Petrucha
On Sat, Sep 10, 2016 at 01:51:00AM -0700, Krešimir wrote: > Hello, > > I have a turn_the_light_on() function that, well, turns on a light... > I put it in wsgi.py (as suggested by internet) just before application = > get_wsgi_application()call. > > Where can I put turn_the_light_off() function

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

2016-09-16 Thread Michal Petrucha
Hi Frederik, On Fri, Sep 16, 2016 at 09:01:53AM -0700, Frederik Elwert wrote: > Hello, > > I am running a site that uses Django 1.8 and Django CMS 3.2. The site is > deployed using gunicorn and nginx. Now I noticed a strange, hard to debug > issue: When accessing a URL without trailing slash, I

Re: cannot import name SortedDict

2016-09-20 Thread Michal Petrucha
On Tue, Sep 20, 2016 at 11:21:20AM -0400, Etienne Robillard wrote: > Hi Alessandro, > > I have replaced the only occurrence of SortedDict with > collections.OrderedDict in app_plugins, but the issue persist. > > Is it possible that the templatetags module is being cached somehow by > Django ? >

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 03:47:11AM -0700, Web Architect wrote: > Hi Serge, > > Thanks for your response. > > We do not have any Views implemented for flatpages. I think they are Django > internal stuff for static html content (something like a CMS): > > https://docs.djangoproject.com/en/1.10/re

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? It's also in 1.

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

2016-09-30 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 01:50:22PM -0700, Stodge wrote: > I have two Django servers A1 and S1, which sit behind a simplistic > NodeJS proxy. This is a silly attempt at single sign on. > > I can log into and out of A1 (authentication server) just fine. If I > log into A1, visit S1 (without being lo

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 just wanted to see if I could >

Re: Redirect after Form

2016-10-31 Thread Michal Petrucha
On Sun, Oct 30, 2016 at 06:39:19AM -0700, Moreplavec wrote: > I found in Django Tutorial solution: > https://docs.djangoproject.com/en/1.10/intro/tutorial04/ : > > Now i have: > > return HttpResponseRedirect(reverse('crm:company_detail', args=(company.pk,))) > #return redirect('views.company_de

Re: Django1.9 Mongodb support

2016-11-04 Thread Michal Petrucha
On Fri, Nov 04, 2016 at 12:33:51PM -0700, Sudhir kumar Giri wrote: > Hello, > I didn't find any documentation or tutorial for Django-1.9 with Mongodb. > Please suggest some docs about it. > Thanks Hi, Django does not have any specific support for mongodb. Of course, you can just use Django witho

Re: External access

2016-11-07 Thread Michal Petrucha
On Mon, Nov 07, 2016 at 08:48:25AM -0500, bob gailer wrote: > I am running a the django server, listening at port 8000. I can access the > server using localhost. When I try using my external ip address I get "The > server at 24.211.133.163 is taking too long to respond." I have port 8000 > forward

  1   2   3   >