Re: Django request.session persist between logins of different users.

2021-06-08 Thread Mateusz Wasielewski
lass view? > > > On Tue, Jun 8, 2021 at 9:17 AM Mateusz Wasielewski > mailto:mateusz.wasielewsk...@gmail.com>> > wrote: > Hello, > I want to implement two factor authetication in my django app. The steps are > as follows: > 1. User need to register > 2. User n

Django request.session persist between logins of different users.

2021-06-07 Thread Mateusz Wasielewski
=True. I have a problem cause when I login as different users this session variable is still set to true. I am probably missing something, I assume that request.session is per user not per whole app. Best regard Mateusz Wasielewski -- You received this message because you are subscribed to

Model inheritance with optional self reference

2021-03-11 Thread Mateusz Wroblewski
Hi All, does anybody have experience with the following data model and could advise which Django tools fit it best? Background: I have two types of Components (Core and Complex) that share many attributes and methods, but also have their own, specific data fields and methods. What complicates

Re: optimisation django

2021-02-11 Thread Mateusz Wasielewski
How your model relation look like? Maybe you face the N+1 problem, Do you check how many queries are performed during your website load? I agree with above: - prefetch_related - select_related -cached_property You can read this article, maybe it can help. https://scoutapm.com/blog/django-and-t

Re: Retrying query when connection error

2019-12-02 Thread Mateusz MTB90
Some suggestion? W dniu czwartek, 28 listopada 2019 12:09:46 UTC+1 użytkownik Mateusz MTB90 napisał: > > Hi It is possible to catch connection error in Django and retry query? > How this can be done? > > Scenario: > query -> connection error occurs -> catch connec

Django retry query when error.

2019-11-28 Thread Mateusz MTB90
Hi it is possible to catch e.g connection error and retry query in Django 2.2? -- 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...@googleg

Retrying query when connection error

2019-11-28 Thread Mateusz MTB90
Hi It is possible to catch connection error in Django and retry query? How this can be done? Scenario: query -> connection error occurs -> catch connection error -> create new connection -> retry query -- You received this message because you are subscribed to the Google Groups "Django users

Re: Instagram embedding

2018-10-14 Thread Mateusz
My assumption, according to https://stackoverflow.com/questions/33295733/utf8-codec-cant-decode-byte-0xe4-invalid-continuation-byte-in-timezone is, that you use German "ä" letter somewhere. Probably your local timezone is "Mitteleuropäische Zeit" which can be displayed by Instagram somewhere i

Re: Connecting Sql server to Django

2018-10-14 Thread Mateusz
: from django.apps import AppConfig class TestappConfig(AppConfig): name = 'testapp' W dniu niedziela, 14 października 2018 19:25:10 UTC+2 użytkownik Pradeep Singh napisał: > > no effect after capitilazation > > On Sun, 14 Oct 2018 at 22:48, Mateusz > > wrot

Re: Connecting Sql server to Django

2018-10-14 Thread Mateusz
Line 2: models.Model (capitalize class name) W dniu niedziela, 14 października 2018 19:09:47 UTC+2 użytkownik Pradeep Singh napisał: > > > > On Sun, 14 Oct 2018 at 22:37, Pradeep Singh > wrote: > >> yes ..i have put the app name in setting.py .wait i will share all screen >> shot >> >> On Sun,

Re: Django model object filter with empty values

2018-10-09 Thread Mateusz
There are many ways to resolve your problem. According to https://stackoverflow.com/questions/769843/how-do-i-use-and-in-a-django-filter this should work: from django.db.models import Q date_range = Q(date_stop__range=[today, today_plus_ten]) date_none = Q(date_start=today, date_stop=None) cours

Re: Django model object filter with empty values

2018-10-09 Thread Mateusz
There are many ways to resolve your problem. According to https://stackoverflow.com/questions/769843/how-do-i-use-and-in-a-django-filter one (or both) of these should work: #1 coursedates_ending = CourseDate.objects.filter(date_stop__range=[today, today_plus_ten], date_stop=None).order_by('dat

Re: Django - using intermediate user group model

2018-09-24 Thread Mateusz
er(group=..., user=...) or via related name (not tested): models.User.in_group_set.all() models.Group.contains_users_set.all() (more on related_name on Stack <https://stackoverflow.com/questions/2642613/what-is-related-name-used-for-in-django> ) W dniu poniedziałek, 24 września 2018 19:18:26 UTC+2 użytkownik Fernando

what's the difference between TemplateView, ListView and DetailView ?

2018-09-23 Thread Mateusz
My answer was not fully on the topic. You shouldn't do what you want to do but if there's a real need for that... You can add context by overriding get_context() method. (context = super().get_context(); context['type'] = list; return context). {% if type == list %} This is a list {% elif type

Re: Django - using intermediate user group model

2018-09-23 Thread Mateusz
Is that User [N] -- [N] Group with many to many through Enrollment (something like that: User [1] -- [N] Enrollment [N] -- [1] Group)? Then, the answer in this gist here . W dniu piątek, 21 września 2018 20:16:05 UTC+2 użytkownik Fernando Balmaceda napi

Re: serializer for multipele views

2018-09-23 Thread Mateusz
You probably solved that already but... You go to *.../api/bookings*/ while your urls.py makes a redirection for *.../api/booking *(there's an analogy to .../api/workspace from the right image). W dniu niedziela, 23 września 2018 11:17:51 UTC+2 użytkownik Tim Vogt napisał: > > I have made an Re

Re: what's the difference between TemplateView, ListView and DetailView ?

2018-09-23 Thread Mateusz
> > Django provides base view classes which will suit a wide range of > applications. All views inherit from the View > > > class, which handles linking the view in to the URLs, HTTP method > di

Re: Update django 1.8 project to 2.0 lts

2018-09-23 Thread Mateusz
This can take a lot of time but if you're really into this, you can see the the release notes for every version between 1.8 and 2.0 (especially for version 2.0 ) and seek for things you can change in your code that were optimised in the meanti

Re: How to create form??

2018-09-23 Thread Mateusz
This may not seem simple, but it is. 1) You need a model with all the fields (docs ), 2) Register that model to be visible on admin page (docs ), 3) Create a form

Re: Creating urls

2018-09-19 Thread Mateusz
Your problem is caused by not properly structurizing your url files. An example (just for reference) is shown below: */myappointments/urls.py* # includes... urlpatterns = [ path('admin/', admin.site.urls), path('', include('clinic.urls'), namespace='clinic'), # for example.com/ where "s

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread Mateusz
isabled, so it is necessary to use readonly but does not show readonly. > > > El martes, 18 de septiembre de 2018, 19:00:37 (UTC-5), Mateusz escribió: >> >> (use traductor si necesita) >> >> I hope I understand your question correctly. >> >> When in

Re: Beginner problem with sqlite3 db

2018-09-18 Thread Mateusz
Cześć! ;) You should first answer a question, why do you even bother using dbshell when there's an other option to deal with data? (docs ) If you know why I'm asking, simply installing sqlite3 is gonna be the best op

Re: How to update if user exist instead of create?

2018-09-18 Thread Mateusz
Just for the record, you should probably consider using CreateView and UpdateView (docs ) if possible. ;) Here is an example (Stack ). W dniu wtorek, 18 września 2018 14:13:20 UTC

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-18 Thread Mateusz
(use traductor si necesita) I hope I understand your question correctly. When in Django 1.8 or 1.9+ you can just do self.fields['destination'].disabled = True in lower versions you should add self.fields['destination'].widget.attrs['disabled'] = True at the end of your __init__(..). W dniu wto

Re: django-filter over models

2018-09-18 Thread Mateusz
Sorry, my previous answer was senseless, I realized that just after adding it. 1) You can filter jobs in appname/views.py: queryset = Job.objects.filter(name__contains="job") 2) and people in template /appname/templates/jobs_list.html: {% for job in object_list %} {{ job.name }} {% fo

Re: django-filter over models

2018-09-18 Thread Mateusz
In that answer I assume Jobs are connected anyhow with Persons with a ForeignKey field like so: *File /appname/models.py:* from django.db import models class Job(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Person(models.Mo

Django on Heroku + AWS S3 thumbnails & originals

2018-09-18 Thread Mateusz
Hi, I am a newbie in Django so my question may be a little bit odd. I tried looking here, on Stack and also GitHub and trying for 5 hours. I try to host a project on Heroku dyno with AWS S3 as a media storage service (images sent by users). My case may be a bit specific cause I *must *store ori

Re: edit hide

2018-09-16 Thread Mateusz Grabuszyński
As far as I understand the question -- you may be looking for that part of the documentation: https://docs.djangoproject.com/en/2.1/faq/admin/#how-do-i-limit-admin-access-so-that-objects-can-only-be-edited-by-the-users-who-created-them W dniu niedziela, 16 września 2018 18:39:31 UTC+2 użytkownik

How do you handle removal of unwanted content (urls, html) from user input?

2018-04-11 Thread Mateusz Kurowski
I would like to remove URLs and HTML from user input. For HTML there is *bleach *library that someone linked today on IRC. I made a little formmixin for this. But now i wonder, maybe you have better ways to do it? Some ready solutions? I would like to strip al

Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Mateusz Kurowski
https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8 https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7 https://www.youtube.com/watch?v=Zo5q48B

Re: Storing lists from api into database

2018-04-06 Thread Mateusz Kurowski
Maybe you should read the documentation first ? :)) 2018-04-06 22:03 GMT+02:00 Mukesh Jha : > My main project is to collect and show the results from news site of a > particular topic. I have use the guardian's api and I have been given 4 > keywords. If I click on any one of the keyword, I need t

Simple Django package - helps you send emails and activation emails from views.

2018-04-05 Thread Mateusz Kurowski
Hello! I am just learning Python and Django, as an exercise for: django views, python packaging, travis, tox, sphinx i made this simple repository with 2 classes that helps you send emails and activation-emails using django builtins. No extra dependencies Tested using hypothesis.. https://gith

Django admin without Groups and Permissions. Can "groups and permissions" tables become a bottleneck?

2018-04-03 Thread Mateusz Kurowski
I don't need groups and permissions, but i want to use django admin. Ive created this simple AbstractSuperUser that looks to solve this case. But i wonder if thats best idea. Can "groups and permissions" tables become a bottleneck in the future even if i dont use any groups and permissions on a

self.assertTemplateUsed bug?

2018-03-28 Thread Mateusz Kurowski
Ive created a sample repository to demonstrate what i think is a bug. https://github.com/seospace/djangorendertostringtest < its fully usable django project, I encountered that bug again in my new project... its pretty frustrating... and this time without "render_to_string" i cant verify used

problems with django-celery

2013-03-26 Thread Mateusz Iwański
Hi, I have a problem with django-celery. When i want to delay function I get an error from celery worker, it happens every second time when i want to use it. Error from celery worker: Can't decode message body: ImportError('No module named manager.apps.ffmpeg.tasks',) (type:u'application/x-p

Re: Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Mateusz Marzantowicz
then setup.py install in src/django directory in virtualenv root? Mateusz Marzantowicz On Mon, Feb 20, 2012 at 1:53 PM, Denis Darii wrote: > Do you mean django-trunk installation? > > If so, I use this in my requirements.txt: > > -e svn+http://code.djangoproject.com/svn/django/tr

Installing Django from GIT/Subversion - package dependency in virtual environment

2012-02-20 Thread Mateusz Marzantowicz
n and then downloads official release. I really need only one Django installation in my virtualenv, the one from git :) It is more related to how pip works but does anyone has any idea how to do it the right way? Thanks, Mateusz Marzantowicz -- You received this message because you are subscri

django tests and namespaced reversed urls

2011-07-05 Thread Mateusz Harasymczuk
I have a problem with tests and namespaced reversed urls. It fails tests. However when running a server they works properly. I have tried #urls.py url(r'^', include('ns.urls', namespace="ns"), name="ns"), #ns/urls.py url(r'name/$', NameView.as_view(), name='home'), #template.html {% url ns:home

dajngo TabularInline fixed objects

2011-07-01 Thread Mateusz Harasymczuk
Is there a way to declare a set of fixed objects in TabularInline? I have: Contract object (with user data, user address and stuff) and tabular inline added months. months names are fixed, and there is some data to change for each month I have done this with JavaScript, setting value of each f

Re: db shardning

2011-07-01 Thread Mateusz Harasymczuk
anyone? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/lv8Uuskxkx0J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe fro

db shardning

2011-06-30 Thread Mateusz Harasymczuk
Hi, I have recently came to the point when I need to use more then one DB in my usecase. I had to deal with storing and getting data from multiple DB, based on how old the data is. I have an archive database to store all logs and data from models to which access will be occasionally. My applica

Re: Django Model Designer - UML

2011-06-26 Thread Mateusz Harasymczuk
I found perfect tool for mac SQLeditor + Django plugin works perfect! http://www.malcolmhardie.com/sqleditor/django/index.html -- Matt Harasymczuk http://www.matt.harasymczuk.pl -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this di

Re: files managing

2011-06-07 Thread Mateusz Marzantowicz
om. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > Please read Django documentation first and then describe your problem. * https://docs.djangoproject.com/en/dev/topics/http/file-uploads/ * https://docs.djangoproject.com/en/dev/ref/models/fiel

Odp: Re: Odp: Re: signals pre_save vs model's save()

2011-06-02 Thread Mateusz Harasymczuk
That was a very good and convincing post :} I am testing a solution with .clean(), which IMHO is a better place to clean data before save() -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://group

Odp: Re: signals pre_save vs model's save()

2011-05-29 Thread Mateusz Harasymczuk
W dniu niedziela, 29 maja 2011, 15:36:13 UTC+2 użytkownik Malcolm Box napisał: > > On 28 May 2011 11:05, Mateusz Harasymczuk wrote: > >> I am thinking about splitting my model's save() method over few signals. >> >> For example, stripping spaces and making strin

Odp: Re: signals pre_save vs model's save()

2011-05-28 Thread Mateusz Harasymczuk
So it should works. Great. my save() methods are much longer than models declaration, and I find it quite a bit confusing to maintain. and for sure, to tell how it works :} from PEP 20 -- The Zen of Python: " Simple is better than complex. ... If the implementation is hard to explain, it's a

signals pre_save vs model's save()

2011-05-28 Thread Mateusz Harasymczuk
I am thinking about splitting my model's save() method over few signals. For example, stripping spaces and making string capitalized. I have even more sophisticated problems such as making an object field active set to False basing on various parameters from other fields, such as expiration dat

Odp: Re: Django Model Designer - UML

2011-05-28 Thread Mateusz Harasymczuk
This is a very good hint. Somehow I had to skipped the inspectdb command. There is humongous number of the DB designing tools. Thank you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg

Django Model Designer - UML

2011-05-27 Thread Mateusz Harasymczuk
I am looking for a GUI tool for modeling Django model classes. I have a pretty large app and I need to refactor it. I used django-extensions and *graph_models* to dump the schema to the GraphViz dot file. And I am stuck here :} I would like to import either GraphViz dot file, or models source fi

Odp: Looking for Class Base Views intro (not Generic Class Base Views!)

2011-05-26 Thread Mateusz Harasymczuk
Anyone? Class Based Views? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more opt

Looking for Class Base Views intro (not Generic Class Base Views!)

2011-05-25 Thread Mateusz Harasymczuk
I am looking for a Class Base Views introduction or tutorial. I have googled the web, and all I was able to find was the Generic Class Base Views. There were only a few examples of non generic views, however the code was to fuzzy. Django generally has a superb documentation, but this part is no

Re: How do you organize your deployment enviroment

2011-05-23 Thread Mateusz Marzantowicz
On Mon, May 23, 2011 at 9:00 AM, DK wrote: > Hi, > > I am having a django project that is being frequently deployed on clean > linux installation. After a few deployments I have noticed that this process > is very time consuming for me (every time I am preparing run scripts for > everything, con

Re: Why errors when restart but goes away after reload again! How fix?

2011-05-22 Thread Mateusz Marzantowicz
On Sun, May 22, 2011 at 8:41 AM, Chris Seberino wrote: > On May 21, 6:35 pm, Mateusz Marzantowicz > wrote: > > What server are you using? What is your configuration? Do you have > mod_wsgi, > > mod_python or something else? What is your browser, OS, etc. Please do > not

Re: Why errors when restart but goes away after reload again! How fix?

2011-05-21 Thread Mateusz Marzantowicz
at is your configuration? Do you have mod_wsgi, mod_python or something else? What is your browser, OS, etc. Please do not let us guess. Mateusz -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

Re: urlpatterns

2011-05-21 Thread Mateusz Marzantowicz
On Sat, May 21, 2011 at 2:14 PM, Mateusz Marzantowicz < mmarzantow...@gmail.com> wrote: > On Sat, May 21, 2011 at 4:50 AM, Dagon wrote: > >> I am a newbie to both Python and Django. >> Why does urlpatterns = patterns('', (r'^People/$', >> 'i

Re: urlpatterns

2011-05-21 Thread Mateusz Marzantowicz
On Sat, May 21, 2011 at 4:50 AM, Dagon wrote: > I am a newbie to both Python and Django. > Why does urlpatterns = patterns('', (r'^People/$', > 'iFriends.People.views.index') get me the following error message: > > Using the URLconf defined in iFriends.urls, Django tried these URL > patterns, in

Re: how to save image in postgreSQL database

2011-05-20 Thread Mateusz Marzantowicz
On Fri, May 20, 2011 at 3:00 AM, ramnivas indani wrote: > ok but how can i achieve it in Django means how can i store images in > Django python using URI Read Django documentation (it is part of studying in college): * http://docs.djangoproject.com/en/1.3/topics/http/file-uploads/ * http://doc

Re: Basic Django Support

2011-05-17 Thread Mateusz Marzantowicz
On Sun, May 15, 2011 at 6:07 PM, David Biglin wrote: > Hi, > I have been playing with Python for the past year now and enjoying it. > I am trying Django to make a web site for a friend. I am Following the > Django Tutorial on there web site to get the basic concepts here; > http://docs.djangoproj

Re: File Field

2011-05-16 Thread Mateusz Marzantowicz
On Fri, May 13, 2011 at 1:44 AM, pankaj sharma wrote: > Hello friends,. > i want to upload some files to my database and show it to user .. > how to add an filefield option to models.py and how to show them in > admin.py. > and how to let the users download the files... > > Do you really want to s

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

2011-05-13 Thread Mateusz Marzantowicz
On Fri, May 13, 2011 at 5:15 AM, 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: > "Welcome Joh

Re: JSON Model Serialization

2009-03-30 Thread Mateusz Wawrzyniak
On Mar 24, 11:05 am, gchuyun wrote: > i tried this, but get a error similar. > > TypeError: [{'publish_time': datetime.datetime(2009, 3, 24, 16, 16, > 18), 'is_deleted': 0, 'is_confirmed' > : 0, 'title': u'1', 'content': u'111', 'id': 1L}, {'publish_time': > datetime.datetime(2009, 3, 24, 16 > ,

Re: JSON Model Serialization

2009-03-15 Thread Mateusz Wawrzyniak
On Mar 14, 10:14 pm, MartinBorthiry wrote: > Hello: > >  I'm Trying to serialize a dict which have a list of Model's instance. > The format that i need is json. Something  like that: > >     people = Person.objects.all() Why don't you use Person.objects.values()? You will get a list of dicts s

[geodjango] Informix

2008-02-17 Thread Mateusz Loskot
ations about using (geo)django with Informix database, especially geospatial stores based on the Informix DataBlade technology. Could anyone put some light on Informix support in django/geodjango? Thanks in advance for any info. Cheers -- Mateu