Re: audit trail functionality in database model

2017-01-23 Thread Melvyn Sopacua
l functionalities. Don't reinvent the wheel. There's more then enough to choose from: https://djangopackages.org/grids/g/model-audit/ -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gr

Re: Multiple forms in the same template

2017-01-23 Thread Melvyn Sopacua
eems. What's the relation between the forms? If they're unrelated, implement get_context_data() to assign them, and form_valid() to process them. Also, bookmark this: https://ccbv.co.uk/ -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.9/releases/1.8/#miscellaneous [2] htt

Re: Multiple forms in the same template

2017-01-24 Thread Melvyn Sopacua
t ModelJSONEncoder >>> ModelJSONEncoder.__mro__ (, , , ) -- Melvyn Sopacua [1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.base/ContextMixin/ [2] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ProcessFormView/ [3] https://ccbv.co.uk/projects/Django

Re: Issue with Tutorial pt 5 "Fixing the bug"

2017-01-24 Thread Melvyn Sopacua
On Monday 23 January 2017 08:22:28 John Wall wrote: > > class QuestionAdmin(admin.ModelAdmin): > fieldsets = [ and whoops: > class QuestionAdmin(admin.ModelAdmin): You have 2, sir. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Gro

Re: Multiple forms in the same template

2017-01-25 Thread Melvyn Sopacua
uses UpdateView[1] which pulls in ModelFormMixin. So this view needs a fields attribute: class M MFormsView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView, MFView): fields = ['foo', 'bar', 'baz'] -- Melvyn Sopacua [1] https://ccbv.co.u

Re: Extended user model to add Profile class want to slugify first_name last_name in profile class

2017-01-25 Thread Melvyn Sopacua
value from a custom callable # (ex. usage: user profile models) slug = AutoSlugField(populate_from=lambda instance: instance.user.get_full_name()) Which is basically what you try to accomplish in the admin. -- Melvyn Sopacua [1] https://pypi.python.org/pypi/django-autoslug -- You received

Re: Validating and cleaning related models ...

2017-01-25 Thread Melvyn Sopacua
ists without >albums, so maybe implementing a procedure that generates that list for content maintainers to process is the better way to guard integrity, since that also covers the case of a DBA "deleting all albums before 1970". -- Melvyn Sopacua [1] http://loc

Re: Extended user model to add Profile class want to slugify first_name last_name in profile class

2017-01-25 Thread Melvyn Sopacua
*viewname *= *self._detail_view_name *or '{}_detail'*.format*(*model_name*)return *viewname, [*/str/(*self.slug*)*] absolute_url *= /property/(*get_absolute_url, doc*="Permalink") class Meta:*abstract *= True * -- Melvyn Sopacua [1] https://docs.

Re: Comparing two lists

2017-01-26 Thread Melvyn Sopacua
return hasattr(self, 'addresses') and \ self.addresses.filter(street__pk=patientid).count() > 0 Remember that Django Template Language strives to keep programming out of the template, so either do the above in your model or in your view when buil

Re: Multiple (limited) Admin feature for each registered user - Best Approach.

2017-01-26 Thread Melvyn Sopacua
ermissions per object. Finer-grained control can be achieved with custom permissions[3] and the user_passes_test decorator[4]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.has_change_permission [2] https://docs.d

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

2017-01-27 Thread Melvyn Sopacua
On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote: > Also I used the tutorial just that I abstracted the concept since I > think the tutorial is more than bad. Awaiting your PRs. -- Melvyn Sopacua -- You received this message because you are subscrib

Re: MultiValueDictKeyError on 'for' loop

2017-01-27 Thread Melvyn Sopacua
otal_forms_count is not in sync with the number of formsets. How? Too much template code and ajax deps to figure out for me, but start here[1]. My gut says you're off-by-one because of forloop.counter usage. -- Melvyn Sopacua [1] http://localhost/doc/py-django/html/topics/forms/for

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

2017-01-27 Thread Melvyn Sopacua
nuar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua: > > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote: > > > Also I used the tutorial just that I abstracted the concept since > > > I > > > > > > think the tutorial is more th

Signals and dispatch uid

2017-01-28 Thread Melvyn Sopacua
_hash within hash_field(), which is less then ideal as it requires the consuming model to alter it's __init__(). Am I missing an option to do this with dispatch_uid from within the field? -- Melvyn Sopacua /# noinspection PyUnresolvedReferences /*class HashDescriptor(/object/):def update

Re: limiting the drop down option of a one-to-one relationship in the admin app. is that possible ?

2017-01-28 Thread Melvyn Sopacua
, set the user to request.user. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#adding-custom-validation-to-the-admin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group a

Re: limiting the drop down option of a one-to-one relationship in the admin app. is that possible ?

2017-01-29 Thread Melvyn Sopacua
est.user) qs = > modelStudent.objects.filter(school=schoolInstance) return qs > > def get_form(self, request, obj=None, **kwargs): This self isn't the form. It's the model admin and should return a ModelForm. The docs I linked has a complete example you can build on. -- Me

Re: form_invalid

2017-01-29 Thread Melvyn Sopacua
la" for demo_code in the form and you will see form_invalid being called. *def clean(*self*):if *self.data[*'demo_code'*] *!= 'valid':raise *ValidationError*('{}: Invalid demo code'*.format*( *self.data[*'demo_code'*]

Re: Django Debug Toolbar installation

2017-01-29 Thread Melvyn Sopacua
at's the same problem since you're pushing settings.py to the server. And for that, see how Mezzanine solved it using a local_settings.py that is not pushed to the server. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django us

Re: set_cookie raise exception when the value contains Unicode charset

2017-01-29 Thread Melvyn Sopacua
project.com/en/1.10/ref/settings/#default-charset I believe your default charset is set to 'iso-8859-1'. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving ema

Re: Issue with Tutorial pt 5 "Fixing the bug"

2017-01-29 Thread Melvyn Sopacua
awesome_factory function - so this works. The result is that in the outer scope Awesome and Magnificent are identical models with a different name and that TheBomb has a name field that enforces uniqueness. Hope this sheds some light on things :) -- Melvyn Sopacua -- You received this mes

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Melvyn Sopacua
ve/django-bootstrap3 > Is there any decent documentation and examples of using locally > installed bootstrap with django? Answered by Andreas. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Limiting choices in a lookup by exclusion

2017-02-01 Thread Melvyn Sopacua
the choices of phone numbers for > > Locations to those that aren't 'C' (cell phones) - I've found some > > hints,> > > but they're all for older versions of Django - it seems like: > > phone = models.ManyToManyField(Phone, limit_choices_to = &g

Re: set_language language switcher with 3 languages

2017-02-03 Thread Melvyn Sopacua
ld be set in the view's context. This ensures you stay at the same page - just in another language. So if the language isn't set properly, something else is going wrong. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users&quo

Re: DJANGO images(upload/download)

2017-02-03 Thread Melvyn Sopacua
rested in the GIS module[1]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/gis/ -- 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

Re: formset in form_class

2017-02-03 Thread Melvyn Sopacua
aram': 'a', > 'choosen': 'value'}] > return form_class(initial=initial) -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop re

Re: Link to urls containing slug

2017-02-03 Thread Melvyn Sopacua
se is needed. Slug, ideally, is also unique, so pick one, not both. -- Melvyn Sopacua -- 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: Web-based Voting System for our capstone project

2017-02-03 Thread Melvyn Sopacua
an I customize my admin page and make some > > dashboard about the students(who have already voted and those who > > haven't yet), -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.list_display [2

Re: How can I solve the broken home page in the root folder?

2017-02-03 Thread Melvyn Sopacua
p like any other. It is only special because it is the entry point of the project, but nothing prevents you from adding models and views there as well. When homepages become complicated this is exactly what people do. Either that, or they create a "homepage" app. -- Melvyn Sopacu

Re: Is it possible to save children before parents?

2017-02-13 Thread Melvyn Sopacua
as to what ImageField does with it's width and height fields. Here's an example: https://gist.github.com/melvyn-sopacua/1b4e4585ab15ffc176798c083470cf04 -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Is it possible to save children before parents?

2017-02-13 Thread Melvyn Sopacua
P.S. I left two bugs in there, for now I'll leave them in as an exercise for the reader. -- Melvyn Sopacua -- 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, se

Re: Is it possible to save children before parents?

2017-02-15 Thread Melvyn Sopacua
On Wednesday 15 February 2017 19:17:55 Mike Dewhirst wrote: > On 14/02/2017 12:14 PM, Melvyn Sopacua wrote: > > P.S. I left two bugs in there, for now I'll leave them in as an > > exercise for the reader. > > Three bugs ... and 2 questions: > > 1. You obviously f

Re: A sort algorithm?

2017-02-17 Thread Melvyn Sopacua
intersect: Room 1 for today: start: 9 hours: 4 becomes set(9, 10, 11, 12) Room 2 for today: start 11: hours: 2 becomes: set(11, 12) Room 3 for today: start: 12 hours: 4 becomes set(12, 13, 14, 15) Target: start: 11 becomes set(11) Room 1 and 2 intersect with target. Room 3 is needed at 12 becau

Re: Extract Date-From and Date-To in DateRangeField django

2017-02-17 Thread Melvyn Sopacua
On Friday 17 February 2017 06:24:25 RON MICHAEL wrote: > No NOT duration. I simply want to get the date_from and the date_to > which is inside the DateRange. You mean the lower and upper[1]. -- Melvyn Sopacua [1] http://initd.org/psycopg/docs/extras.html#psycopg2.extras.Date

Re: Subquery has too many columns

2017-02-18 Thread Melvyn Sopacua
t=True) > descricao = models.TextField() > objects = ProdutoServicoManager() > > class Meta: > base_manager_name = 'objects' Cause this doesn't actually do anything, beside being explicit. -- Melvyn Sopacua -- You received this message because you are s

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
e, this still is probably incorrect, since this doesn't contain the app prefix). -- Melvyn Sopacua -- 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 t

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
return reverse('mymodel_detail', args=(), kwargs=kwargs) urls.py: urlpatterns = ( url( '^(?P[a-z0-9-A- Z_-]+)/(?[0-9]+)-(?P[a-z0-9-A-Z_-]+)/$', views.MyModelDetailView.as_view(), name='mymodel_detail'

Re: Implementing a basic search for my website

2017-02-20 Thread Melvyn Sopacua
nding the 2 conditions, which should be fast and the second somewhat more complex: where NOT the anded condition and the OR condition. Which to pick, is really a matter of performance: which method does best under pressure and what resource can you scale cheaper / faster? -- Melvyn Sopacua

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
test_base_manager_update(*self*): *self.cart.items.update*(*is_shipped*=True) *shipped *= *self.cart.items.filter*(*is_shipped*=True)*.count*() *self.assertEqual*(*shipped, 2*) * > On Saturday, February 18, 2017 at 9:20:03 PM UTC-3, Melvyn Sopacua wrote: > >

Re: authenticate function is always returning none in views.py

2017-02-21 Thread Melvyn Sopacua
#x27;') > user = auth.authenticate(username=username, password=password) > placeholder="Password"> -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Timeout when saving model in django admin page

2017-02-21 Thread Melvyn Sopacua
ing a WSGI request that come into play. Increasing those, also means you tie up resources and are more succeptable to denial of service, so if celery is an option, take it. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Initial data, tests and migrations

2017-02-21 Thread Melvyn Sopacua
run? All explained in the docs[1]. Either redeclare the same fixtures for different test cases or reorganize your testcases to share the same fixture(s). -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/testing/tools/#django.test.TransactionTe stCase.fixtures --

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
> > from model_mommy import mommy > > from core import models > > class FaturamentoTest(TestCase): > > def test(self): > faturamento = mommy.make(models.Faturamento) > produto = faturamento.produto_servico > try: > produto.save(

Re: Is this possible with Django, new to this!

2017-02-22 Thread Melvyn Sopacua
This isn't in my project requirements, so I'm only recording stock mutations. If I had to, I'd switch my custom mutations to one of these audit trail packages[5]. So in conclustion it certainly is possible, but do it for the right reasons :). -- Melvyn Sopacua [1] h

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
On Wednesday 22 February 2017 14:22:36 'Tom Evans' via Django users wrote: > On Wed, Feb 22, 2017 at 12:47 AM, Melvyn Sopacua wrote: > > On Tuesday 21 February 2017 19:00:42 'Tom Evans' via Django users wrote: > >> What is the "correct&quo

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
o_otp.tests import SuperTest class SuperTestWithMyData(SuperTest): fixtures = ['my_data'] -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Models/Foreign Keys best practice

2017-02-22 Thread Melvyn Sopacua
es for each role. These are reasons to use Foreign Keys. Otherwise, just use a CharField. If you don't need to record anything special about roles, there's also the middle ground using a field's choices[2]. You use choices instead of a Foreign Key if they hardly ever change and

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
et_rfid not save(). If you call save() after calling set_rfid, the value isn't saved? -- Melvyn Sopacua -- 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 emai

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
ot even Model(not_editable_value='foo'). It merely means, that you will implement saving the value without the help of ModelForm. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: Flattening model relationships (in APIs)

2017-02-23 Thread Melvyn Sopacua
use it to render easily. You can then use AddressSerializer to provide the full structured address, so it can be used for writes. You may need to customize how it flattens the models, but that's what DRF's documentation[1] is for. -- Melvyn Sopacua [1] http://www.django

Re: Many to Many in Django Admin

2017-02-23 Thread Melvyn Sopacua
On Thursday 23 February 2017 05:22:25 José Vicente Jonas França wrote: > I Like to know if its possible to display the many-to-many field in > both pages of Model at Django Admin. > If it is possible how can i do this? All available in the documentation[1]. -- Melvyn Sopacua --

Re: Connecting to a database with logged in user credentials

2017-02-23 Thread Melvyn Sopacua
ink was posted: https://github.com/ambitioninc/django-dynamic-db-router So no, they're not static. This package may not suit your needs, but it's mechanism with a custom router should help you along. -- Melvyn Sopacua -- You received this message because you are subscribed to the Goog

Re: Benefit of 'return Foo.objects.all()' in a ListView

2017-02-25 Thread Melvyn Sopacua
return self.model.objects.filter(user=self.request.user) -- Melvyn Sopacua -- 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...@goo

Re: Benefit of 'return Foo.objects.all()' in a ListView

2017-02-25 Thread Melvyn Sopacua
hod() is True ] group2 = [ obj for obj in qs if obj.boolean_method() is False ] # update the context context.update( { 'group1': group1, 'group2': group2 } ) # and return it

Re: Template packages for simple data entry and table data management for business applications

2017-02-25 Thread Melvyn Sopacua
n objects[3] * Tighter permissions[4] * RichText Editor: CkEditor[5] / TinyMCE[6] -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.list_display [2] https://djangopackages.org/grids/g/admin-interface/ [

Re: database update after paypal payment

2017-03-01 Thread Melvyn Sopacua
ayPal: - Check for success / failure - If success: set paid to True, redirect to /thank-you - else: display error and cart -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: good 404 vs bad 404

2017-03-01 Thread Melvyn Sopacua
A different approach would be to treat the notification mails the way you treat spam. Notifications that are "user errors" are "spam", notifications that are "application errors" are "ham". Using baysian filtering, the number of "user errors" should dem

Re: Django Migrations?

2017-03-01 Thread Melvyn Sopacua
is largely depending on the error. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: Django Migrations?

2017-03-02 Thread Melvyn Sopacua
If you: - ran migrate --fake - created a new migration fixing the error Then yes, it will still bother you when deploying a new instance. Don't see how that could bother you on a database that is already migrated though. -- Melvyn Sopacua -- You received this message because you are sub

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
Then makemessages should generate a string with msgctxt for each of the choices. You could do this already, by rolling your own "trans" tag and "makemessages" command. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
code? Wel, you can create your own commands: https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/ And your own tags: https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/ So if waiting for a next release that may or may not have this functionality does not fit

Re: How to keep track of online users?

2017-03-02 Thread Melvyn Sopacua
tatus" you'd need to use your own session store to store the additional "last_online" field and middleware to update it automatically. Code above contains ample hints for you to start digging. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/htt

Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-05 Thread Melvyn Sopacua
u either: 1/ Do a redirect, which is the simplest 2/ Request your resources incorporating the session id I still would go for 1/, simply because that fixes the disconnect between template path / view path and requested url. -- Melvyn Sopacua -- You received this message because you are subscr

Re: How do you populate an update form in a Bootstrap Modal?

2017-03-05 Thread Melvyn Sopacua
to prepopulate the form in the modal you need to provide the instance argument and assign it the model instance. I assume you know what model instance you need to update. -- Melvyn Sopacua [1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ModelFormMixin/ --

Re: How do you populate an update form in a Bootstrap Modal?

2017-03-05 Thread Melvyn Sopacua
form media in the AdditionalFormsManager, so it certainly isn't production quality yet - but it will work just fine for illustration purposes or base for your own code. -- Melvyn Sopacua [1] https://gist.github.com/melvyn-sopacua/2e848fa5b8be0f53c2a5267ba68d570e -- You received this

Re: Chart library for django

2017-03-06 Thread Melvyn Sopacua
On Sunday 05 March 2017 22:10:07 Luvpreet Singh wrote: > I am looking for some solution to display django database queryset to > django admin over graphs. https://djangopackages.org/grids/g/charts/ Problem is, the majority is abandonware. -- Melvyn Sopacua -- You received this m

Re: Issue with Django-axes

2017-03-06 Thread Melvyn Sopacua
_BACKENDS[1] reject inactive users." >From the docs[2]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-AUTHENTICATION_BACKENDS [2] https://docs.djangoproject.com/en/1.10/topics/auth/default/ -- You received this message because you ar

Re: Chart library for django

2017-03-06 Thread Melvyn Sopacua
- graph type often depending on data - title, legend, labels All this is dictated by the content at the server and has to be injected into js via template rendering. The packages in that grid aim to do just that (and I cound 3 that use highcharts). -- Melvyn Sopacua -- You received this messa

Re: stop backgroundworker

2017-03-06 Thread Melvyn Sopacua
t location for an updated value. I recommend Redis for this > purpose. +1. In fact, I would not use Django to set the "stop looping" flag, since there is no advantage to that, unless the stops need to be tied to content in the database. But to just alter a value in redis, I'd use

Re: Postgres (sqlmigrate) FK to M2M without RunPython

2017-03-07 Thread Melvyn Sopacua
python code: python manage.py sqlmigrate app_label migration_name |psql dbname Or save the output, put it on db server and load it there. I don't see why though. Just run migrate on the server that runs django. -- Melvyn Sopacua -- You received this message because you are subscri

Re: Error running Django tutorial

2017-03-08 Thread Melvyn Sopacua
Hi, On Tuesday 07 March 2017 01:24:02 Vanja Falck wrote: > urlpatterns = [ > url(r'ˆpolls/', include('polls.urls')), > url(r'^admin/', admin.site.urls), > ] Easy to see this way. You didn't type a caret but some unicode sign that

Re: Postgres (sqlmigrate) FK to M2M without RunPython

2017-03-08 Thread Melvyn Sopacua
ot *creating* migrations, you're *applying* migrations. Please review the difference between "makemigrations" and "migrate" command. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Simple Join with no matching primary keys

2017-03-08 Thread Melvyn Sopacua
roblem is easily solved. Since the two models are identical, why would you use two models? Your problem starts with your design - rethink it. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Simple Join with no matching primary keys

2017-03-08 Thread Melvyn Sopacua
the join needs to do. Find duplicates? Get all of them in either table? Provide the right question and Django will do the right join. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Redirection to SSO using Django

2017-03-08 Thread Melvyn Sopacua
On Wednesday 08 March 2017 05:26:02 Arun S wrote: > My Project, i would want to redirect login page to a SSO page. > and handle redirection in Django. Don't solve what others already did for you: https://djangopackages.org/packages/p/django-allauth/ -- Melvyn Sopacua -- You re

Re: Logging CSRF errors and other HTTP errors by Django

2017-03-08 Thread Melvyn Sopacua
On Wednesday 08 March 2017 06:15:42 Web Architect wrote: > Is there a way to log CSRF errors? Like whenever an user visits my > site and faces a CSRF error, I would like Django to log it in a file. Did you read the logging documentation[1]? -- Melvyn Sopacua [1]

Re: Redirection to SSO using Django

2017-03-09 Thread Melvyn Sopacua
gin/success) 1) Redirect the login to the SSO 2) At /login/success store the data you receive and mark the user logged in. The data you receive at /login/success should identify your user. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Djan

Re: Is it good practice to access the request from a model manager?

2017-03-09 Thread Melvyn Sopacua
he place to assert you did (if you remember to write a test for it ...). -- Melvyn Sopacua -- 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

Re: Help: Data model in django

2017-03-09 Thread Melvyn Sopacua
quot;attributes"? And yes, if you want some kind of structure for rendering, then JSONField is a good choice. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: Django queryset High CPU Usage

2017-03-10 Thread Melvyn Sopacua
0%. What's the problem? You have a fast db, fast network and requesting 10k records into memory. Why would you want CPU usage to be lower so that it takes longer? The question you need to ask yourself is why you need 10k records. Nobody's gonna read them all. -- Melvyn Sopacua -- You rece

Re: Django queryset High CPU Usage

2017-03-10 Thread Melvyn Sopacua
d-only slave of the database. This scales much better and doesn't tie up webserver resources. -- Melvyn Sopacua -- 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: Is it good practice to access the request from a model manager?

2017-03-11 Thread Melvyn Sopacua
in.get_object() and it's counterpart MultipleObjectMixin.get_queryset(), you can setup an inheritance chain that does all the work for you. But without some code examples for those edge cases and their view inheritance, it's hard to predict and it may be comfy to have a 2nd line of defe

Re: Q? Packaging app best practices (lots of questions)

2017-03-11 Thread Melvyn Sopacua
kage that matters. One of the most annoying things about reusable apps is that quite a few don't namespace their lookups. So in a project I cannot re-namespace them to resolve conflicts. > * Using apps: I found the workflow quite painful because I'm putting > the app in github b

Re: Is this a bug? KeyError: 'is_popup' on mysite/admin, while logging level = DEBUG. Django 1.10.6.

2017-03-11 Thread Melvyn Sopacua
ogged, so that one is still able to determine why code fails that you think shouldn't fail. -- Melvyn Sopacua -- 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 e

Re: connect Django to MySQL and i get this error

2017-03-11 Thread Melvyn Sopacua
;, line 24, in > import MySQLdb as Database > ImportError: No module named 'MySQLdb' You have all the information[1] to resolve it. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/install/#database-installation -- You received this message bec

Re: Django queryset High CPU Usage

2017-03-11 Thread Melvyn Sopacua
ick this up again in final stages to see if there's something that can be done. > It could easily be a missing "select_related" which causes thousands > of joins inside a for loop. Good one. Takes a few seconds to check if not move on. -- Melvyn Sopacua -- You received this messag

Re: Django channels being used instead of celery.

2017-03-14 Thread Melvyn Sopacua
nd why you've turned a simple push protocol into a complicated message exchange. The pis are more then capable of keeping state of last sent data, so why not just throw it over the wire and be done with it. Let the server figure out what to do with the package. -- Melvyn Sopacua -- You rec

Re: Can't log in to admin interface:

2017-03-15 Thread Melvyn Sopacua
as: admin. Any chance you have django.contrib.sites in INSTALLED_APPS but do NOT have a SITE_ID configured in settings.py? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop r

Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Melvyn Sopacua
= nginx > socket = unix:///socket/uwsgi.sock Where did you read the unix prototol is a network protocol that requires two slashes to indicate it is? And then add another to reference the root of the network domain? > uwsgi_pass unix:///socket/uwsgi.sock; See above. -- Melv

Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Melvyn Sopacua
n to the URI rules, not the rule itself. Also, just providing a plain path (socket = /var/run/uwsgi/myapp.sock) in uwsgi.ini works. Of course, it will try to create the socket under the user uwsgi runs as, so permissions for the directory need to allow that. -- Melvyn Sopacua -- You recei

Re: superuser having all permissions makes perm checking messy

2017-03-17 Thread Melvyn Sopacua
, who have already solved the problem - Django Guardian being one of them. -- Melvyn Sopacua -- 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+

Re: Programming Error at admin

2017-03-20 Thread Melvyn Sopacua
ack the database. If you use migrations to alter your schema, you should always use migrations or be prepared to jump down the rabbit hole. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: , received 404

2017-03-23 Thread Melvyn Sopacua
On Wednesday 22 March 2017 23:55:06 æ Žå¿—æ˜Ž wrote: > Ubuntu 14.04 Desktop, > apache 2.4.7, > python 3.4.3, > Djanog 1.10.6 And your WSGI config? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To

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

2017-03-25 Thread Melvyn Sopacua
ld inquire how to "use a previously defined WSGIDaemonProcess in a virtual host". Then keep the definition out of the the vhost file and have it included somewhere sooner. (Or use a different letsencrypt client that doesn't fiddle with webserver configs, and reference files using a good n

Re: problrm with django contact form

2017-03-25 Thread Melvyn Sopacua
Hello, On Saturday 25 March 2017 09:13:19 Bassam Ramadan wrote: > but i do not receive any mail on my email account You didn't setup your EMAIL_ settings[1]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/settings/#email-host -- You received this message

Re: Django Produces Python?

2017-03-26 Thread Melvyn Sopacua
ums it up quite nicely. -- Melvyn Sopacua [1] https://hackernoon.com/use-django-or-end-up-building-a-django-6cce65eb7255#.nkw8i79ww -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop recei

Re: Django tutorial HTTP Error 404

2017-03-26 Thread Melvyn Sopacua
told to test runserver *before* creating the app. This is because the "it worked" page is a little magic that depends on DEBUG=True and only the admin urlpatterns registered. As soon as you add more urls the magic stops working and since you did not define a homepage url, it is a g

Re: django allauth and AdminSite reverse()

2017-03-26 Thread Melvyn Sopacua
Yes, and the 4th is missing. You could start by reading the fabulous manual[1]: the part in the bottom about "urls.py". -- Melvyn Sopacua [1] http://django-allauth.readthedocs.io/en/latest/installation.html -- You received this message because you are subscribed to the Goog

Re: Django Captcha Ajax call not working

2017-03-27 Thread Melvyn Sopacua
On Monday 27 March 2017 04:46:06 valerio orfano wrote: > {% if field.name = 'captcha' %} It may not make a difference if you only have one visible field, but this is not a comparison. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Gr

Re: Django Captcha Ajax call not working

2017-03-27 Thread Melvyn Sopacua
t; > exclude = [] > > > > class ajaxModel(models.Model): > > testfield = models.TextField(null=True, blank=True) > > > > If i don't use a ajaxmodel a get an error, so testfield is just a > > dummy field, just to avoid error. > > > > v

Re: Channels - logout not resetting message.user value on new WebSocket connections

2017-03-27 Thread Melvyn Sopacua
he API to reply_channel.accept() and reply_channel.reject(). > > def ws_connect(message, slug): > > if message.user.is_authenticated(): > > message.reply_channel.send({"accept": True}) > > > > else: > > message.reply_channel.send({"acc

<    1   2   3   4   5   6   7   >