Re: Missing manage.py & settings.py

2019-03-01 Thread lujate
Interesting. I never thought about doing a pip install of an application. I'm 
going to have to digest that one. 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a50ea53d-8fcc-4f9e-819b-a5cd1ac42216%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Missing manage.py & settings.py

2019-03-01 Thread Dylan Reinhold
The project django-wiki is not a django project, it is a django app. You
include the app in your project.
The settings file in the install document is your settings file from your
django project.

Dylan

On Fri, Mar 1, 2019 at 5:13 PM lujate  wrote:

> I pip installed a Django project, but it doesn’t have a manage.py or
> settings.py.  I checked the repo on GitHub, and those files don’t exist
> there either.  Is this an alternate way of doing a Django project that I’m
> not aware of?
>
> FWIW, the project is django-wiki.
>
> TIA
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/30fc5fdc-6bd6-4807-99ff-c41e6e109642%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHtg44D6kYqryCcconSmwaTQV2K2MHBw0%2BEka-JBqiDSWLd7eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Missing manage.py & settings.py

2019-03-01 Thread lujate
I pip installed a Django project, but it doesn’t have a manage.py or 
settings.py.  I checked the repo on GitHub, and those files don’t exist there 
either.  Is this an alternate way of doing a Django project that I’m not aware 
of?

FWIW, the project is django-wiki.

TIA

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/30fc5fdc-6bd6-4807-99ff-c41e6e109642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


using amazon aim to authenticate?

2019-03-01 Thread fenrir . sivar
I have a django site in develoment for data analysis (50-200 users world 
wide, all with amazon aim users accounts).
django auth and django-allauth work like a charm, but I would like to know 
if it is possible to authenticate a django app against Amazon AIM 
users/roles intead of having to manage separate logins for each n AIM and 
the Django app

I cant find any examples. Any hints are appreciated

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24ff3418-a81b-479d-8737-11236e9ac4cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django vue javascript integration

2019-03-01 Thread Sithembewena L. Dube
The issue here appears to be that OP's browser cannot load the .js file as
specified in the resource path. I would agree with Wira about checking what
the path is and ensuring that the .js file is in the correct location.

Kind regards,
Sithembewena


*Sent with Shift
*

On Fri, Mar 1, 2019 at 11:52 PM Sam W  wrote:

> Why don't you use Django REST framework ?
>
> On Friday, March 1, 2019 at 11:36:37 AM UTC-6, Tomas Garijo wrote:
>>
>> Hello group,
>>
>> I have a huge problems to integrate a vue javascript file in one template, 
>> only for testing, I'm searching on google but unfortuny I can't find 
>> anything.
>> I have a simple html file and I want to load a code that is in other file, 
>> of course this files is a *.js file
>>
>> The best is attach some file to see the problem
>>
>> You can see in the html file,  there is some comment code this is a test to 
>> see if the javascript code works fine, and this works fine.
>> But when this javascript code put in other file and load from html file (I'm 
>> not sure this will be true) the code doesn't work fine.
>>
>>
>> Kinds Regards
>>
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4c236c3c-6d18-4d5f-af34-2cc2c947122f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-SnCDk1yzG4KfQ8isUg3LZzHPhW3ROaAaH4d%3D7NYPjmvwBFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django vue javascript integration

2019-03-01 Thread Sam W
Why don't you use Django REST framework ?

Try this :

How to Integrate Vue.js with Django Rest Framework?
https://www.techiediaries.com/django-rest-vuejs/

On Friday, March 1, 2019 at 11:36:37 AM UTC-6, Tomas Garijo wrote:
>
> Hello group,
>
> I have a huge problems to integrate a vue javascript file in one template, 
> only for testing, I'm searching on google but unfortuny I can't find anything.
> I have a simple html file and I want to load a code that is in other file, of 
> course this files is a *.js file
>
> The best is attach some file to see the problem
>
> You can see in the html file,  there is some comment code this is a test to 
> see if the javascript code works fine, and this works fine.
> But when this javascript code put in other file and load from html file (I'm 
> not sure this will be true) the code doesn't work fine. 
>
>
> Kinds Regards
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a923a79a-6362-4f1c-8abc-59c6e9b60997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to override the ModelAdmin "change" form ?

2019-03-01 Thread Mike Dewhirst

On 2/03/2019 2:08 am, karim.at...@gmail.com wrote:

Hi Mike,

I tried what you wrote by overriding the *self.change_form_template* 
but the form does not appear.
Would you please provide me the content of your model admin 
*billing_payment_view ?*


Sure. I recently asked for assistance here and posted most of the code ...

https://groups.google.com/forum/#!topic/django-users/809HBmPa9vk

You are right, my application is different. My template contains a 
script provided by Stripe which calls their API to collect a credit card 
payment. But overall it isn't much different than any other template 
called by any other view. The view just takes a different path depending 
on whether it is a POST or a GET request. My view looks complex because 
when the user clicks [Pay now] it happens in the Stripe js embedded in 
the template and the Stripe API - in turn - hits my view with the actual 
POST containing the result of the credit card transaction. I had to seed 
the form/template with hidden data so it travelled across the Stripe 
boundary and back to me so I could complete the processing. If you can 
see past that complication it should be clear that I'm using the form to 
clean the data and the view to interface with the ORM/database.


It is working well for me now and I'm in the middle of writing unit tests.

Good luck



Thanks.

Karim

Le vendredi 1 mars 2019 00:06:40 UTC+1, Mike Dewhirst a écrit :

On 28/02/2019 9:46 pm, karim...@gmail.com  wrote:

Hi,

I'm currently struggling with a custom ModelAdmin.


Karim

I haven't tried to fully understand your use case. However, this
is what I think your process could be if you do not wish to ajax
it ...

1. Override the model save() method to call a model method which
detects your trigger scenario and calls the code you wish to
execute to collect all the data you wish to display. This might be
in the parent model or the m2m 'through' model. Unlikely to be in
the child model.

2. Write a Form to reveal the data you wish to display. It
probably needs to be a ModelForm

3. Write a template for the data including any hidden fields for
object pks and additionally consider calling {{ block.super }} to
display inherited stuff if you are extending another template and
using the same block. When I first started to work all this out I
was able to get my form to appear at the top of the ModelAdmin
form using block.super and spent a bit of time hiding the big red
[Delete] button because it was too close to my big blue [Pay now]
button. However, as I got deeper into it I somehow lost that and
never got it back. I was so pleased with getting it working
eventually that I persuaded myself I didn't really want it on the
same page anyway. Your mileage may vary :) I think you need to
hard-code the form in the ModelAdmin to get it appearing above
everything else.

4. Write any necessary urls

5. Write a view to manipulate your data, based on the request and
your form

6. Get the Admin to display it on demand. The first line of the
change_view() method below initialises the ModelAdmin to do
absolutely nothing different than usual. Nothing will happen
unless the trigger is detected. Then finally call to super to
resume the normal course of events when your code is complete.
What follows is my own recent experience. The comments should tell
you more than the code

def change_view(self, request, object_id, form_url='', extra_context=None):

     """ self = SubstanceAdmin
 request = wsgi request object
 object_id = substance
 form_url = no idea!
 extra_context = dict of apps, models, admin_urls and permissions

 https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django  
.
 contrib.admin.ModelAdmin.change_view

     """
 # Let the ModelAdmin resume normal operations with its own template
 self.change_form_template = None
 # queryset of m2m records from the 'through' table
 ingredients = 
Substance_Ingredients.objects.filter(substance_id=object_id)
 subscription = None
 for sm2mi in ingredients:
 # sm2mi.fee_payable() is the detector which triggers the process
 payable, fee_type = sm2mi.fee_payable()  # eg., True, PAID_DATA
 if payable:
 # generate a subscription record with blank token field or
 # if one exists with a non-blank token, return None
 subscription = billing_subscribe(sm2mi, fee_type)
 if subscription:# collect money for the owner
 # switch the ModelAdmin to the new template
 self.change_form_template = 'payment.html'
 # assemble all the necessary data for the view
 

Re: django vue javascript integration

2019-03-01 Thread Sam W
Why don't you use Django REST framework ?

On Friday, March 1, 2019 at 11:36:37 AM UTC-6, Tomas Garijo wrote:
>
> Hello group,
>
> I have a huge problems to integrate a vue javascript file in one template, 
> only for testing, I'm searching on google but unfortuny I can't find anything.
> I have a simple html file and I want to load a code that is in other file, of 
> course this files is a *.js file
>
> The best is attach some file to see the problem
>
> You can see in the html file,  there is some comment code this is a test to 
> see if the javascript code works fine, and this works fine.
> But when this javascript code put in other file and load from html file (I'm 
> not sure this will be true) the code doesn't work fine. 
>
>
> Kinds Regards
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c236c3c-6d18-4d5f-af34-2cc2c947122f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why are foreign keys rewritten when adding related_name?

2019-03-01 Thread Simon Charette
Hello HM,

I know that some changes have been made to avoid unnecessary foreign key
rebuilds on some option changes.

Are you experiencing this on 2.1 and 2.2 pre release?

Simon

Le vendredi 1 mars 2019 02:40:01 UTC-5, HM a écrit :
>
> I added "related_name" to an exiting ForeignKey and checked with 
> "django-admin sqlmigrate" what would be done. 
>
> It seems that the foreign key constraint is dropped, then the exact 
> same constraint is added back. Why? 
>
> Example: If we have the classes: 
>
> class Wall(models.Model): 
> .. 
>
> class Door(models.Model): 
> ..wall = models.ForeignKey(Wall) 
>
> and change Door.wall to models.ForeignKey(Wall, related_name='walls'), 
> then: 
>
> Prior to this, there exist (postgres) the constraint: 
>
> "app_door_wall_id_45647_fk_app_wall" FOREIGN KEY (wall_id) REFERENCES 
> app_wall(id) DEFERRABLE INITIALLY DEFERRED. 
>
> "django_admin sqlmigrate" reports: 
>
> SET CONSTRAINTS "app_door_wall_id_45647_fk_app_wall" IMMEDIATE; ALTER 
> TABLE  "app_door" DROP CONSTRAINT 
> "app_door_wall_id_45647_fk_app_wall"; 
> ALTER TABLE "app_door" ADD CONSTRAINT 
> "app_door_wall_id_45647_fk_app_wall" FOREIGN KEY ("wall_id") 
> REFERENCES "app_wall" ("id") DEFERRABLE INITIALLY DEFERRED; 
>
> After running the migration, which is run as there's stuff in the log, 
> there exists seemingly the same constraint as before: 
>
> "app_door_wall_id_45647_fk_app_wall" FOREIGN KEY (wall_id) REFERENCES 
> app_wall(id) DEFERRABLE INITIALLY DEFERRED. 
>
> Why waste a connection this way? 
>
> -- 
> HM 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1d9f7a9-be2a-41d5-8a43-4b468ad4a547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need Help in Django 2.1 (Over_view )

2019-03-01 Thread Jason
https://www.mikeash.com/getting_answers.html

Might want to ask a question first

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24699638-0807-4249-8a83-7a22f382994e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Need Help in Django 2.1 (Over_view )

2019-03-01 Thread iakash95768
need help in Django version 2.1 regarding a project.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ea2df7ff-dfcf-4952-8767-727cb5dcc668%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with aggregates needed

2019-03-01 Thread Felix Carbonell
Hello, Simon. Thank you very much! Your solution worked like a charm!!!

Best regards,
Felix.

El jueves, 28 de febrero de 2019, 0:09:35 (UTC-5), Simon Charette escribió:
>
> Hello Felix,
>
> month = ...
> year = ...
> Expenses.objects.filter(
> year=year,
> ).values(
> area_name=F('area__name'),
> element_name=F('element__name')
> ).annotate(
> year_sum=Sum('cost'),
> month_sum=Sum('cost', filter=Q(month=month)),
> )
>
> Should generate SQL along the following lines on PostgreSQL
>
> SELECT
> area.name AS area_name,
> element.name AS element_name,
> SUM(expenses.cost) AS year_sum,
> SUM(expenses.cost) FILTER (WHERE month = $month) month_sum
> FROM
> expenses
> INNER JOIN area ON (
> expenses.area_id = area.id
> )
> INNER JOIN element ON (
> expenses.element_id = element.id
> )
> WHERE expenses.year = $year
> GROUP BY area.name, element.name
> ORDER BY area.name, element.name
>
> Cheers,
> Simon
>
> Le mercredi 27 février 2019 14:04:21 UTC-5, Felix Lazaro Carbonell a 
> écrit :
>>
>> Hi to everyone:
>>
>>  
>>
>> Having models like these:
>>
>>  
>>
>> class Area(models.Model):
>>
>> name = models.CharField(max_lentgh=30)
>>
>>  
>>
>>  
>>
>> class Element(models.Model):
>>
>> name = models.CharField(max_lentgh=30)
>>
>>  
>>
>>  
>>
>> class Expenses(models.Model):
>>
>> area = models.ForeignKey(Area, on_delete=models.CASCADE )
>>
>> element = models.ForeignKey(Element, on_delete=models.CASCADE )
>>
>> year = models.SmallIntegerField()
>>
>> month = models.SmallIntegerField()
>>
>> cost = model.DecimalField(max_digits=10, decimal_places=2, default=0)
>>
>>  
>>
>>  
>>
>> I would like to group by area, then by element, and then get sum by month 
>> and accumulated expenses for that element in the year. how could that be 
>> done using Django ORM?
>>
>>  
>>
>> Something to show like this
>>
>>  
>>
>> Expenses in 
>> current
>>
>> AreaElement   Month   Year
>>
>> Operations  Cell phone325.65 712.40
>>
>> Operations   Office consumibles451.00 1028.56
>>
>> Main office   Cell phone 148.89 284.41
>>
>> Main office  Office consumibles650.00 1300.00
>>
>>  
>>
>> Thanks in advance,
>>
>> Felix.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f22fd8e-b1ea-4e68-86b4-f042123ab43e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with first program

2019-03-01 Thread Julio Cojom
If you use sublime text, try this, right down corner, it says "Tab size" -> 
Convert Indentation to Tabs.

[image: Sin título.png]

El jueves, 28 de febrero de 2019, 17:14:33 (UTC-6), Edvani Pascoal escribió:
>
> hey guys I'm beginner on django I never worked with this framework before 
> and then I've problems to started polls app this is the error:
> (my_env) root@ubuntu:~/django-test/djangoproject# python manage.py 
> runserver 192.168.184.202:8000
>
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x7fa7af08b9d8>
> Traceback (most recent call last):
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 248, in raise_last_exception
> raise _exception[1]
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 337, in execute
> autoreload.check_errors(django.setup)()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/__init__.py",
>  
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/registry.py",
>  
> line 112, in populate
> app_config.import_models()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/config.py",
>  
> line 198, in import_models
> self.models_module = import_module(models_module_name)
>   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in 
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 674, in exec_module
>   File "", line 781, in get_code
>   File "", line 741, in 
> source_to_code
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> question_text = models.CharField(max_length=200)
> ^
> IndentationError: expected an indented block
>
>
> I need help how to solve this??
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/834e5bba-48fb-4fbd-a007-22a66218e5dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with first program

2019-03-01 Thread gauravsrivastava2k17
Doing copy-paste always lead to indentation fault.Try to copy the code on 
any editor and then indent 2nd statement by 4 or 8 space indent .

On Friday, March 1, 2019 at 4:44:33 AM UTC+5:30, Edvani Pascoal wrote:
>
> hey guys I'm beginner on django I never worked with this framework before 
> and then I've problems to started polls app this is the error:
> (my_env) root@ubuntu:~/django-test/djangoproject# python manage.py 
> runserver 192.168.184.202:8000
>
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x7fa7af08b9d8>
> Traceback (most recent call last):
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 248, in raise_last_exception
> raise _exception[1]
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 337, in execute
> autoreload.check_errors(django.setup)()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/__init__.py",
>  
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/registry.py",
>  
> line 112, in populate
> app_config.import_models()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/config.py",
>  
> line 198, in import_models
> self.models_module = import_module(models_module_name)
>   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in 
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 674, in exec_module
>   File "", line 781, in get_code
>   File "", line 741, in 
> source_to_code
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> question_text = models.CharField(max_length=200)
> ^
> IndentationError: expected an indented block
>
>
> I need help how to solve this??
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d1b8309-247d-4926-ab17-de6eb18b70a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Issue with ManyToMany Relations

2019-03-01 Thread Julio Cojom
I'm writting 2 models with ManyToMany Relations, first I make a model to 
list all my requirements

class Requirements(models.Model):
requirement = models.CharField(max_length=150)
def __str__(self):
return self.requirement

So in this example my list of requirements will be:

   - Personal ID
   - Letter from your boss 
   - Last degree obtained
   - Photography
   
Now I make custom list from different scenarios, since not all jobs require 
the same documents, my model will be: 

class RequirementsList(models.Model):
job= models.ForeignKey(Jobs, on_delete=models.DO_NOTHING)
requirements= models.ManyToManyField(Requirements)

def __str__(self):
return str(self.job)

Now I can pick some of my requeriments and make custom lists from each job 
or position avaliable.

Last, I make my 3rd model , with a relation between RequirementList and File

class FileDetail(models.Model):
file= models.ForeignKey(File, on_delete=models.DO_NOTHING)
job = models.ForeignKey(Jobs, on_delete=models.DO_NOTHING, blank=True, 
null=True)
requeriments = models.ManyToManyField(RequirementsList)

def __str__(self):
return self.file

So I need my requirement list to filter what requirements who has to be in 
my file, but this only give to me in requirements a list of lists instead 
of requirements in the list.

I been reading the docs and found the "through" parameter but I can't make 
it work.

Somone has a clue of what I'm doing wrong?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4837fd8e-1193-48ba-a869-f233faf92443%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django vue javascript integration

2019-03-01 Thread Wira Bhakti
Maybe you must put your JavaScript file on your static directory...

On Sat, 2 Mar 2019 00:36 Tomas Garijo  Hello group,
>
> I have a huge problems to integrate a vue javascript file in one template, 
> only for testing, I'm searching on google but unfortuny I can't find anything.
> I have a simple html file and I want to load a code that is in other file, of 
> course this files is a *.js file
>
> The best is attach some file to see the problem
>
> You can see in the html file,  there is some comment code this is a test to 
> see if the javascript code works fine, and this works fine.
> But when this javascript code put in other file and load from html file (I'm 
> not sure this will be true) the code doesn't work fine.
>
>
> Kinds Regards
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/96e67572-ba1a-47e3-9396-38fef2f98c44%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJko4_oMRkiYK6m8zNt8yNFkLi4Bcp932ZKo0O4C6EsN0ckOww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django vue javascript integration

2019-03-01 Thread Tomas Garijo


Hello group,

I have a huge problems to integrate a vue javascript file in one template, only 
for testing, I'm searching on google but unfortuny I can't find anything.
I have a simple html file and I want to load a code that is in other file, of 
course this files is a *.js file

The best is attach some file to see the problem

You can see in the html file,  there is some comment code this is a test to see 
if the javascript code works fine, and this works fine.
But when this javascript code put in other file and load from html file (I'm 
not sure this will be true) the code doesn't work fine. 


Kinds Regards



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96e67572-ba1a-47e3-9396-38fef2f98c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with first program

2019-03-01 Thread Sam W
The error is very clear "IndentationError: expected an indented block" Use 
PyCharm IDE OR Visual Studio Code.
Also, never use Keyboard Spacebar for indentation , always use Tab for 
indentation. TO solve your problem take the question_text to the beginning 
of the line then hit the Tab once. 



On Thursday, February 28, 2019 at 5:14:33 PM UTC-6, Edvani Pascoal wrote:
>
> hey guys I'm beginner on django I never worked with this framework before 
> and then I've problems to started polls app this is the error:
> (my_env) root@ubuntu:~/django-test/djangoproject# python manage.py 
> runserver 192.168.184.202:8000
>
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x7fa7af08b9d8>
> Traceback (most recent call last):
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 248, in raise_last_exception
> raise _exception[1]
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 337, in execute
> autoreload.check_errors(django.setup)()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/__init__.py",
>  
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/registry.py",
>  
> line 112, in populate
> app_config.import_models()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/config.py",
>  
> line 198, in import_models
> self.models_module = import_module(models_module_name)
>   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in 
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 674, in exec_module
>   File "", line 781, in get_code
>   File "", line 741, in 
> source_to_code
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> question_text = models.CharField(max_length=200)
> ^
> IndentationError: expected an indented block
>
>
> I need help how to solve this??
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d1cfb81-5305-4d3b-882b-8c99d8cae3f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorials Needed

2019-03-01 Thread Sam W
This YouTube Channel  is really good Taught by  Corey Schafer
https://www.youtube.com/watch?v=UmljXZIypDc

Python Django Tutorial: It has more than 17 videos about Django. 


On Thursday, February 28, 2019 at 12:54:06 PM UTC-6, Madhav Rajmohan wrote:
>
> Friends,
> I am Madhav Rajmohan currently pursuing  my Studies in 
> Computer Science, I Need some good beginners* Tutorial for Django.*And at 
> the same time some tutorials* for advanced python*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce32c250-6a3b-4a62-af38-99fa4627374c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to override the ModelAdmin "change" form ?

2019-03-01 Thread karim . atiki
Hi Mike,

I tried what you wrote by overriding the *self.change_form_template* but 
the form does not appear.
Would you please provide me the content of your model admin  
*billing_payment_view 
?*

Thanks.

Karim

Le vendredi 1 mars 2019 00:06:40 UTC+1, Mike Dewhirst a écrit :
>
> On 28/02/2019 9:46 pm, karim...@gmail.com  wrote:
>
> Hi, 
>
> I'm currently struggling with a custom ModelAdmin.
>
>
> Karim
>
> I haven't tried to fully understand your use case. However, this is what I 
> think your process could be if you do not wish to ajax it ...
>
> 1. Override the model save() method to call a model method which detects 
> your trigger scenario and calls the code you wish to execute to collect all 
> the data you wish to display. This might be in the parent model or the m2m 
> 'through' model. Unlikely to be in the child model.
>
> 2. Write a Form to reveal the data you wish to display. It probably needs 
> to be a ModelForm
>
> 3. Write a template for the data including any hidden fields for object 
> pks and additionally consider calling {{ block.super }} to display 
> inherited stuff if you are extending another template and using the same 
> block. When I first started to work all this out I was able to get my form 
> to appear at the top of the ModelAdmin form using block.super and spent a 
> bit of time hiding the big red [Delete] button because it was too close to 
> my big blue [Pay now] button. However, as I got deeper into it I somehow 
> lost that and never got it back. I was so pleased with getting it working 
> eventually that I persuaded myself I didn't really want it on the same page 
> anyway. Your mileage may vary :) I think you need to hard-code the form in 
> the ModelAdmin to get it appearing above everything else.
>
> 4. Write any necessary urls
>
> 5. Write a view to manipulate your data, based on the request and your form
>
> 6. Get the Admin to display it on demand. The first line of the 
> change_view() method below initialises the ModelAdmin to do absolutely 
> nothing different than usual. Nothing will happen unless the trigger is 
> detected. Then finally call to super to resume the normal course of events 
> when your code is complete. What follows is my own recent experience. The 
> comments should tell you more than the code
>
> def change_view(self, request, object_id, form_url='', extra_context=None):
>
> """ self = SubstanceAdmin
> request = wsgi request object
> object_id = substance
> form_url = no idea!
> extra_context = dict of apps, models, admin_urls and permissions
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.
> contrib.admin.ModelAdmin.change_view 
>
> """
> # Let the ModelAdmin resume normal operations with its own template
> self.change_form_template = None
> # queryset of m2m records from the 'through' table
> ingredients = Substance_Ingredients.objects.filter(substance_id=object_id)
> subscription = None
> for sm2mi in ingredients:
> # sm2mi.fee_payable() is the detector which triggers the process
> payable, fee_type = sm2mi.fee_payable()  # eg., True, PAID_DATA
> if payable:
> # generate a subscription record with blank token field or
> # if one exists with a non-blank token, return None
> subscription = billing_subscribe(sm2mi, fee_type)
> if subscription:# collect money for the owner
> # switch the ModelAdmin to the new template
> self.change_form_template = 'payment.html'
> # assemble all the necessary data for the view
> context = billing_collect_context(
> sm2mi,
> subscription,
> )
> # get everything into the payment_view context
> if not extra_context:
> extra_context = dict()
> extra_context.update(self.admin_site.each_context(request))
> extra_context.update(context)
> # wrap the view to protect it with Admin permissions
> self.admin_site.admin_view(
> # call the view with request and context
> billing_payment_view(
> request,
> sm2mi,
> subscription,
> context=extra_context,
> )
> )
> # only one sm2mi at a time
> break
> return super(SubstanceAdmin, self).change_view(
> request, object_id, form_url, extra_context
> )
>
>
>
>  
>
> 7. Call super in the model save() method *or* raise an exception to 
> prevent saving. I'm actually not sure about this bit. It may go against the 
> Django flow. However, I do use a BusinessRuleViolation exception which 
> inherits from ValidationError and therefore lets me include a human 
> readable 

Re: Models in admin view

2019-03-01 Thread Andréas Kühne
Hi,

You can look here:
https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin

This is the functionality you want.

Regards,

Andréas


Den fre 1 mars 2019 kl 14:05 skrev raghav b <
raghav.balasubraman...@gmail.com>:

> I have created two apps with the name candidate and another training. In
> the Django admin I want to create trainings and add candidates to that. I
> have created candidate and training and registered in the admin view. But
> for the last part I want to add multiple candidates into a training from
> admin view. How can I do this? Please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e11b3b78-be4a-4ac7-a1bd-b452540c7e76%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCcmESgn12u3dOgEiLfC2fe9HPyk5q8cKM-9W6USMwrV3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'URLPattern' Object is not a mapping

2019-03-01 Thread Anh Nguyen
Try path or re_path instead of url

On Fri, Mar 1, 2019 at 8:25 PM Tina Upadhyay 
wrote:

> Please suggest
>
> On Fri, Mar 1, 2019, 8:22 AM Tina Upadhyay 
> wrote:
>
>> This is working fine on my local machine but on server it is not.Can
>> anyone suggest that what can i do to fix this??
>>
>>
>> On Fri, Mar 1, 2019 at 12:22 AM  wrote:
>>
>>> umm
>>>
>>>
>>> On Tuesday, February 26, 2019 at 6:06:20 PM UTC+5:45, Tina Upadhyay
>>> wrote:

 Getting this error and the urls.py of my model is as shown below:


 from django.conf.urls import url
 from new import views
 app_name = 'new'


 urlpatterns = [
 url(r'^export/csv/$', views.export_users_csv, name='export_users_csv'),
 # url(r'^$', views.upload, name='uplink'),
 url(r'^download/(.*)', views.download, name="download"),
 url(r'^download_attachment/(.*)/(.*)', views.download_as_attachment,
 name="download_attachment"),
 url(r'^exchange/(.*)', views.exchange, name="exchange"),
 url(r'^parse/(.*)', views.parse, name="parse"),
 url(r'^import/', views.import_data, name="import"),
 url(r'^import_sheet/', views.import_sheet, name="import_sheet"),
 url(r'^export/(.*)', views.export_data, name="export"),
 url(r'^handson_view/', views.handson_table, name="handson_view"),

 # handson table view
 url(r'^embedded_handson_view/',
 views.embed_handson_table, name="embed_handson_view"),
 url(r'^embedded_handson_view_single/',
 views.embed_handson_table_from_a_single_table,
 name="embed_handson_view"),
 # survey_result
 # url('^survey_result/',
 # views.survey_result, name='survey_result'),

 # testing purpose
 url(r'^import_using_isave/',
 views.import_data_using_isave_book_as),
 url(r'^import_sheet_using_isave/',
 views.import_sheet_using_isave_to_database),
 url(r'^import_without_bulk_save/',
 views.import_without_bulk_save, name="import_no_bulk_save")
 ]

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/8a4bb715-ba69-43b8-abe7-78daee9a0dd2%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BWonebZGNYAqLmCardG4j7Vyeos7gj4D%3DRWw%2Bo2rWFNnewEFg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKaoNbSuZF%3Dp0J1UYyn8s_kxhA1__YJ8o-6O2DnbJzOi%2B_EJ5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'URLPattern' Object is not a mapping

2019-03-01 Thread Tina Upadhyay
Please suggest

On Fri, Mar 1, 2019, 8:22 AM Tina Upadhyay 
wrote:

> This is working fine on my local machine but on server it is not.Can
> anyone suggest that what can i do to fix this??
>
>
> On Fri, Mar 1, 2019 at 12:22 AM  wrote:
>
>> umm
>>
>>
>> On Tuesday, February 26, 2019 at 6:06:20 PM UTC+5:45, Tina Upadhyay wrote:
>>>
>>> Getting this error and the urls.py of my model is as shown below:
>>>
>>>
>>> from django.conf.urls import url
>>> from new import views
>>> app_name = 'new'
>>>
>>>
>>> urlpatterns = [
>>> url(r'^export/csv/$', views.export_users_csv, name='export_users_csv'),
>>> # url(r'^$', views.upload, name='uplink'),
>>> url(r'^download/(.*)', views.download, name="download"),
>>> url(r'^download_attachment/(.*)/(.*)', views.download_as_attachment,
>>> name="download_attachment"),
>>> url(r'^exchange/(.*)', views.exchange, name="exchange"),
>>> url(r'^parse/(.*)', views.parse, name="parse"),
>>> url(r'^import/', views.import_data, name="import"),
>>> url(r'^import_sheet/', views.import_sheet, name="import_sheet"),
>>> url(r'^export/(.*)', views.export_data, name="export"),
>>> url(r'^handson_view/', views.handson_table, name="handson_view"),
>>>
>>> # handson table view
>>> url(r'^embedded_handson_view/',
>>> views.embed_handson_table, name="embed_handson_view"),
>>> url(r'^embedded_handson_view_single/',
>>> views.embed_handson_table_from_a_single_table,
>>> name="embed_handson_view"),
>>> # survey_result
>>> # url('^survey_result/',
>>> # views.survey_result, name='survey_result'),
>>>
>>> # testing purpose
>>> url(r'^import_using_isave/',
>>> views.import_data_using_isave_book_as),
>>> url(r'^import_sheet_using_isave/',
>>> views.import_sheet_using_isave_to_database),
>>> url(r'^import_without_bulk_save/',
>>> views.import_without_bulk_save, name="import_no_bulk_save")
>>> ]
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8a4bb715-ba69-43b8-abe7-78daee9a0dd2%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BWonebZGNYAqLmCardG4j7Vyeos7gj4D%3DRWw%2Bo2rWFNnewEFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorials Needed

2019-03-01 Thread anushap762
Hi pradeep, Could u plz share django stuff if possible


On Friday, March 1, 2019 at 11:29:37 AM UTC+8, Pradeep Singh wrote:
>
> bro i have django & python videos + materials 
>
> On Fri, 1 Mar 2019 at 04:04, Motaz Hejaze  > wrote:
>
>> Why dont you google whatever you want ؟؟؟!!!
>>
>> On Thu, 28 Feb 2019, 22:49 Lutalo Bbosa joseph, > > wrote:
>>
>>> try introduction to python by sentdex on youtube
>>>
>>> On Thu, Feb 28, 2019 at 9:54 PM Madhav Rajmohan >> > wrote:
>>>
 Friends,
 I am Madhav Rajmohan currently pursuing  my Studies in 
 Computer Science, I Need some good beginners* Tutorial for Django.*And 
 at the same time some tutorials* for advanced python*

 -- 
 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...@googlegroups.com .
 To post to this group, send email to django...@googlegroups.com 
 .
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/c98acb13-6845-4fc2-856c-cc11757d40ab%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAMz%3Dh%3DQvmmmrjX4qj9_DxTTXVX3LcnprdX-V4e%2Bgwp0MFJxy2Q%40mail.gmail.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAHV4E-fVQUBAC8mEJkm03PQW%2B8PVGqZThi9SgcOgQjM0Dxd2qg%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1fd44c8-fbd1-4ede-8d2c-fbf12425776c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Models in admin view

2019-03-01 Thread raghav b
I have created two apps with the name candidate and another training. In the 
Django admin I want to create trainings and add candidates to that. I have 
created candidate and training and registered in the admin view. But for the 
last part I want to add multiple candidates into a training from admin view. 
How can I do this? Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e11b3b78-be4a-4ac7-a1bd-b452540c7e76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: looking for team members as my technical Advisory

2019-03-01 Thread Jai Singhal
I am interested

On Friday, 22 February 2019 15:32:27 UTC+5:30, Nura Bash wrote:
>
> Good day, all am Nura bashir CEO of Teamlead enterprise Nigeria, am 
> looking for Technical advisory members for my project which am about to 
> start here in West Africa, is a plot project from 10 selected schools to 
> help train  kids django.. 
>
> If any one is interested I can be reach out via whatpp +23434832618 or my 
> email nurabas...@gmail.com 
> Thank you 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bdb5d5b8-096b-47f5-971c-69f9db1558fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorials Needed

2019-03-01 Thread priya . dutta
Hi Madhav Rajmohan, 

Try --- Tutorials for Advance python and django by durga prasad. I learnt 
it from there.



On Friday, March 1, 2019 at 12:24:06 AM UTC+5:30, Madhav Rajmohan wrote:
>
> Friends,
> I am Madhav Rajmohan currently pursuing  my Studies in 
> Computer Science, I Need some good beginners* Tutorial for Django.*And at 
> the same time some tutorials* for advanced python*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ad64b77-91c6-425c-a2c6-a518ef1d35ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorials Needed

2019-03-01 Thread Jani Tiainen
Hi,

A good starting point is Django Girls tutorial. It covers basic Python and
Django with proper workflow and tool support and even deployment.

On Thu, Feb 28, 2019 at 8:54 PM Madhav Rajmohan 
wrote:

> Friends,
> I am Madhav Rajmohan currently pursuing  my Studies in
> Computer Science, I Need some good beginners* Tutorial for Django.*And at
> the same time some tutorials* for advanced python*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c98acb13-6845-4fc2-856c-cc11757d40ab%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocFXd9UBnYYoC76Di53FKg49i5DdYDEWdfKAVOiR9v36w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to override the ModelAdmin "change" form ?

2019-03-01 Thread karim . atiki
Hi Mike,

Thanks a lot for your feedback.
Your situation is quiet different from mine, BUT the way you override 
change_view and the related template will certainly help me to achieve what 
I need.
...and getting rid of dirty and unnecessary ajax calls.

I keep you posted.

Thx.

Karim

Le vendredi 1 mars 2019 00:06:40 UTC+1, Mike Dewhirst a écrit :
>
> On 28/02/2019 9:46 pm, karim...@gmail.com  wrote:
>
> Hi, 
>
> I'm currently struggling with a custom ModelAdmin.
>
>
> Karim
>
> I haven't tried to fully understand your use case. However, this is what I 
> think your process could be if you do not wish to ajax it ...
>
> 1. Override the model save() method to call a model method which detects 
> your trigger scenario and calls the code you wish to execute to collect all 
> the data you wish to display. This might be in the parent model or the m2m 
> 'through' model. Unlikely to be in the child model.
>
> 2. Write a Form to reveal the data you wish to display. It probably needs 
> to be a ModelForm
>
> 3. Write a template for the data including any hidden fields for object 
> pks and additionally consider calling {{ block.super }} to display 
> inherited stuff if you are extending another template and using the same 
> block. When I first started to work all this out I was able to get my form 
> to appear at the top of the ModelAdmin form using block.super and spent a 
> bit of time hiding the big red [Delete] button because it was too close to 
> my big blue [Pay now] button. However, as I got deeper into it I somehow 
> lost that and never got it back. I was so pleased with getting it working 
> eventually that I persuaded myself I didn't really want it on the same page 
> anyway. Your mileage may vary :) I think you need to hard-code the form in 
> the ModelAdmin to get it appearing above everything else.
>
> 4. Write any necessary urls
>
> 5. Write a view to manipulate your data, based on the request and your form
>
> 6. Get the Admin to display it on demand. The first line of the 
> change_view() method below initialises the ModelAdmin to do absolutely 
> nothing different than usual. Nothing will happen unless the trigger is 
> detected. Then finally call to super to resume the normal course of events 
> when your code is complete. What follows is my own recent experience. The 
> comments should tell you more than the code
>
> def change_view(self, request, object_id, form_url='', extra_context=None):
>
> """ self = SubstanceAdmin
> request = wsgi request object
> object_id = substance
> form_url = no idea!
> extra_context = dict of apps, models, admin_urls and permissions
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.
> contrib.admin.ModelAdmin.change_view 
>
> """
> # Let the ModelAdmin resume normal operations with its own template
> self.change_form_template = None
> # queryset of m2m records from the 'through' table
> ingredients = Substance_Ingredients.objects.filter(substance_id=object_id)
> subscription = None
> for sm2mi in ingredients:
> # sm2mi.fee_payable() is the detector which triggers the process
> payable, fee_type = sm2mi.fee_payable()  # eg., True, PAID_DATA
> if payable:
> # generate a subscription record with blank token field or
> # if one exists with a non-blank token, return None
> subscription = billing_subscribe(sm2mi, fee_type)
> if subscription:# collect money for the owner
> # switch the ModelAdmin to the new template
> self.change_form_template = 'payment.html'
> # assemble all the necessary data for the view
> context = billing_collect_context(
> sm2mi,
> subscription,
> )
> # get everything into the payment_view context
> if not extra_context:
> extra_context = dict()
> extra_context.update(self.admin_site.each_context(request))
> extra_context.update(context)
> # wrap the view to protect it with Admin permissions
> self.admin_site.admin_view(
> # call the view with request and context
> billing_payment_view(
> request,
> sm2mi,
> subscription,
> context=extra_context,
> )
> )
> # only one sm2mi at a time
> break
> return super(SubstanceAdmin, self).change_view(
> request, object_id, form_url, extra_context
> )
>
>
>
>  
>
> 7. Call super in the model save() method *or* raise an exception to 
> prevent saving. I'm actually not sure about this bit. It may go against the 
> Django flow. However, I do use a BusinessRuleViolation exception which 
> inherits 

Re: Problems with first program

2019-03-01 Thread Harryxon Ndegwa
The problem is with the indentation,the question_text field is wrongly
indented.ensure you have a python friendly IDE or text editor

On Fri, 1 Mar 2019 3:06 am bob gailer  On 2/28/2019 6:08 PM, Edvani Pascoal wrote:
> > hey guys I'm beginner on django I never worked with this framework
> > before and then I've problems to started polls app this is the error:
> >
> deleting most of the traceback since in this case it is not relevant.
> >   File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> > question_text = models.CharField(max_length=200)
> > ^
> > IndentationError: expected an indented block
> >
> Here is the head of models.py, as copied from the tutorial
>
> from django.db import models
>
>
> class Question(models.Model):
>  question_text = models.CharField(max_length=200)
>
> Your copy of that file is different. Statement that end in : must be
> followed by at least one indented line. These are known as "compound
> statements" (if, elif, else, while, for, try, except, finally, with).
>
> --
> Bob Gailer
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/580f4cd8-1d87-56a0-7548-c20e26e3e446%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPqDb9NK6bLX80R1LXC6OCe5TM-bPB51u-6AwX1mhtSAPscgzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.