Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-03-02 Thread Boris Pérez
One way could be latest_action=ActionGame.obje cts.filter(published=published).order_by('-id')[:1] El jue, 2 mar 2023 a las 17:29, Sandip Bhattacharya (< sand...@showmethesource.org>) escribió: > Your problem is still about where the 'published’ value is coming from in > the call to filter(publi

Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-03-02 Thread Sandip Bhattacharya
Your problem is still about where the 'published’ value is coming from in the call to filter(published=published). Is it coming from a form? A Get parameter? A post parameter? Extract it appropriately before calling filter() > On Mar 2, 2023, at 3:46 AM, Byansi Samuel wrote: > > def action (

Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-03-02 Thread Byansi Samuel
Hey thanks, but l tried to use ordering=('-published') On Feb 28, 2023 5:04 PM, "Dev Femi Badmus" wrote: all_action=ActionGame.objects.all() my_action = [] for action in all_action: my_action.append(action) last_action = my_action[-1] On Tue, Feb 28, 2023 at 1:05 PM Andréas Kühne wrote:

Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-02-28 Thread Andréas Kühne
I'm sorry Dev, but that is really bad practice. You are doing in python what can be done by the database. That type of code would create a memory error and be very slow to run. It's much better to get the last item from the database. In your example it would just be: last_action = ActionGame.objec

Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-02-28 Thread Dev Femi Badmus
all_action=ActionGame.objects.all() my_action = [] for action in all_action: my_action.append(action) last_action = my_action[-1] On Tue, Feb 28, 2023 at 1:05 PM Andréas Kühne wrote: > Se comments below. > > > Den fre 24 feb. 2023 kl 12:14 skrev Byansi Samuel < > samuelbyans...@gmail.com>:

Re: How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-02-28 Thread Andréas Kühne
Se comments below. Den fre 24 feb. 2023 kl 12:14 skrev Byansi Samuel : > Hey everyone, l got a problem. Am trying to retrieve a single latest > object added everytime, and display it in the template. > Below is my codes but; > > Help me figure it out the source of the problem in these different

How to retrieve the latest object added (new one) in Django models and display it in the template?

2023-02-24 Thread Byansi Samuel
Hey everyone, l got a problem. Am trying to retrieve a single latest object added everytime, and display it in the template. Below is my codes but; Help me figure it out the source of the problem in these different instances below 👇 ___ issue number 1___ #Action/models.py

Re: HOW TO GET DJANGO MODELS FIELD VALUE FROM MODEL OBJECT IN TEMPLATE TAGS-DJANGO

2022-11-07 Thread James
Hi; There's a method you're supposed to override in your views (inherit from Views) to do what you want, it's called "get_context_data". This method will pump whatever data you send to it into your template tags. On Sunday, November 6, 2022 at 4:15:35 AM UTC-7 rani...@gmail.com wrote: > my mo

Re: HOW TO GET DJANGO MODELS FIELD VALUE FROM MODEL OBJECT IN TEMPLATE TAGS-DJANGO

2022-11-06 Thread Kala Rani
I want to get region_name field values in my template.its .giving null value On Sunday, November 6, 2022 at 8:31:42 PM UTC+5:30 sebasti...@gmail.com wrote: > Pls write us your aim with this code... > > Kala Rani schrieb am So., 6. Nov. 2022, 12:15: > >> my models.py >> >> class Locations(models

Re: HOW TO GET DJANGO MODELS FIELD VALUE FROM MODEL OBJECT IN TEMPLATE TAGS-DJANGO

2022-11-06 Thread Sebastian Jung
Pls write us your aim with this code... Kala Rani schrieb am So., 6. Nov. 2022, 12:15: > my models.py > > class Locations(models.Model): > region = models.ForeignKey(Regions, > on_delete=models.CASCADE,blank=True,null=True) > name = models.CharField(max_length=255) > active_flag = models.Boolean

HOW TO GET DJANGO MODELS FIELD VALUE FROM MODEL OBJECT IN TEMPLATE TAGS-DJANGO

2022-11-06 Thread Kala Rani
my models.py class Locations(models.Model): region = models.ForeignKey(Regions, on_delete=models.CASCADE,blank=True,null=True) name = models.CharField(max_length=255) active_flag = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now_add = True) updated_at = models.DateTim

Customise Django Models

2022-09-11 Thread Jishnu C K
Hi, Some blogs I have written, hope someone find it useful :) https://jishnuck.medium.com/customizing-django-models-to-facilitate-user-restricted-data-768fe8206f82 <https://jishnuck.medium.com/customizing-django-models-to-facilitate-user-restricted-data-768fe8206f82> Jishnu C K j

Re: Sanitize field from xss attacks in django models

2021-11-06 Thread omar ahmed
each/ > > On Saturday, 6 November 2021 at 12:44:05 UTC omark...@gmail.com wrote: > >> hi all >> i want to sanitize 'content' field from XSS attacks in django models >> so i installed 'bleach' and used but script like "an >> evil() exam

Re: Sanitize field from xss attacks in django models

2021-11-06 Thread Steven Mapes
m validation in, then call super afterwards. You could also look at django-bleach - https://pypi.org/project/django-bleach/ On Saturday, 6 November 2021 at 12:44:05 UTC omark...@gmail.com wrote: > hi all > i want to sanitize 'content' field from XSS attacks in django models > so

Sanitize field from xss attacks in django models

2021-11-06 Thread omar ahmed
hi all i want to sanitize 'content' field from XSS attacks in django models so i installed 'bleach' and used but script like "an evil() example" store as is (without sanitize script) Note: i need bleach via function in models Any idea ? Thanks [image: bleach-Mode

Re: UML to Django models

2021-08-27 Thread Ahmet Faruk Yılmaz
#x27;ll need to use ForeignKey fields to link related tables, of course. >>>> >>>> HTH. >>>> >>>> On Thursday, 26 August 2021 at 10:28:23 UTC+2 abubak...@gmail.com >>>> wrote: >>>> >>>>> can anyone help me? >>&g

Re: UML to Django models

2021-08-26 Thread DJANGO DEVELOPER
>>> On Thursday, 26 August 2021 at 10:28:23 UTC+2 abubak...@gmail.com wrote: >>> >>>> can anyone help me? >>>> >>>> On Thu, Aug 26, 2021 at 9:32 AM DJANGO DEVELOPER >>>> wrote: >>>> >>>>> Currently, I

Re: UML to Django models

2021-08-26 Thread Cale Roco
On Thu, Aug 26, 2021 at 9:32 AM DJANGO DEVELOPER >>> wrote: >>> >>>> Currently, I am working on an inventory management system and I have >>>> got some UML diagrams and want to convert those uml diagrams into django >>>> models. So

Re: UML to Django models

2021-08-26 Thread DJANGO DEVELOPER
of course. > > HTH. > > On Thursday, 26 August 2021 at 10:28:23 UTC+2 abubak...@gmail.com wrote: > >> can anyone help me? >> >> On Thu, Aug 26, 2021 at 9:32 AM DJANGO DEVELOPER >> wrote: >> >>> Currently, I am working on an inventory management s

Re: UML to Django models

2021-08-26 Thread Derek
26, 2021 at 9:32 AM DJANGO DEVELOPER > wrote: > >> Currently, I am working on an inventory management system and I have got >> some UML diagrams and want to convert those uml diagrams into django >> models. So can anyone guide me on how to convert those UML diagrams into

Re: UML to Django models

2021-08-26 Thread DJANGO DEVELOPER
can anyone help me? On Thu, Aug 26, 2021 at 9:32 AM DJANGO DEVELOPER wrote: > Currently, I am working on an inventory management system and I have got > some UML diagrams and want to convert those uml diagrams into django > models. So can anyone guide me on how to convert those UML

UML to Django models

2021-08-25 Thread DJANGO DEVELOPER
Currently, I am working on an inventory management system and I have got some UML diagrams and want to convert those uml diagrams into django models. So can anyone guide me on how to convert those UML diagrams into django models? an example is below of uml diagram -- You received this message

HOW TO ADD SKIP LOGIG TO DJANGO MODELS

2021-07-29 Thread Winstone Makwesheni
Hello guys,can anyone help me to add skip logic to django models, i feel too lazy to use Django Forms and then add javascript and jquery, is there a way to add them directly to models? Cheers Winstone -- You received this message because you are subscribed to the Google Groups "Django

How to make relationship in django models in such scenario

2020-12-31 Thread Dhruvil Shah
*models.py* So,here i want to make Invoicemgmt model in which i can have multiple entries for Invoice table having customer,project and Invoice_amount. Basically,requirement is that whenever i see 'view_Invoice' of some id,first i will see all data of that specific id on that page and then i want

Cryptography in Django Models

2020-12-09 Thread Shahprogrammer
Hi Everybody, I have just created a package for bi-directional cryptography in Django Models. It has following features:- 1. *Supports data **retrieval* 2. *Supports custom query* 3. *Supports Q() queries* 4. *Supports Ordering data through python functions* 5. *Supports Sorting

Custom attributes on Django models through mixins

2020-10-23 Thread Umang Sharan
Hi, Stackoverflow link for all the details: https://stackoverflow.com/ questions/64485888/add-custom-attributes-to-django-models-through-mixins Tl;dr - dynamically setting method attributes on models through mixin classes doesn't work as expected. Appreciate any help. -- You received

Re: Need the create statements for my Django models

2020-08-11 Thread Derek
"I was recently porting a legacy DB to Django by using the inspectdb command" - is there any reason why you cannot just stop here? Why do you think the "inspectdb" would fail? I would just go on creating the app and if any issues arise, I'd look at the specific model and see if it is because

Need the create statements for my Django models

2020-08-07 Thread Saahitya E
Hi, I was recently porting a legacy DB to Django by using the inspectdb command and then manually comparing the model to the corresponding table description. I want to confirm that I have not made any mistakes by getting the corresponding SQL create commands that migrate would have used to cre

Re: Regarding Django models.

2020-06-18 Thread MANISH YADAV
But if I use SQL Alchemy, can I use django admin panel. Because need that. -- 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

Re: Regarding Django models.

2020-06-18 Thread DOT. py
Use SQL Alchemy ORM , Django ORM has foreign key policy , if u can solve it using that it's on u .. On Fri, Jun 19, 2020, 01:23 MANISH YADAV wrote: > hello community members, > I am a student and interested in Django. can you please help me. > I am designing a project in Django. For that, I have

Regarding Django models.

2020-06-18 Thread MANISH YADAV
hello community members, I am a student and interested in Django. can you please help me. I am designing a project in Django. For that, I have my database schema which consists of the composite primary key and composite foreign key. But Django does not support any type of composite key. I have tr

Django models for user

2020-05-09 Thread Irfan Khan
i am working on a LMS project, so if a tutor signed up and he can upload his tutorials from his account. And when rendering to template each user should have their list of tutorials. as well as he will upload new tutorials. How to design it dynamically. Please guide me. Thank you in advance. --

Django models and multiprocessing: "no results to fetch"

2020-02-24 Thread Rainer Hihn
Hi all, in my project, I'm traversing through a huge directory with millions of files, parse them and write the results into a Postgres database. Unfortunately, I'm facing erros when I'm using multiprocessing.Pool with more than one processes. This is how I'm inserting new values into the datab

Re: How to Extract values of diffrent from foreign key in django models

2020-01-11 Thread Integr@te System
Hi Manas, What about User model!? (Because of ForeignKey you declared) This is where Friend.object.get() come from Friend model of current user. On Sun, Jan 12, 2020, 11:50 manas srivastava wrote: > > > > I have made a model to make friends using Django model. Now I am unable to > get the f

How to Extract values of diffrent from foreign key in django models

2020-01-11 Thread manas srivastava
I have made a model to make friends using Django model. Now I am unable to get the friend id through the model. The model is as follows class Friend(models.Model): users = models.ManyToManyField(User) #following users current_user = models.ForeignKey(User, related_name='owner', null

Re: Creating Django models dynamically

2019-12-29 Thread Integr@te System
Hi, Look at Django CMS features as it is in your purpose. On Sun, Dec 29, 2019, 20:35 Meet Vasani wrote: > Is there any way to create model for the database using form input from > the end user ? > > Scenario: There is authority for the particular company. Authority wants > to create HTML form

Creating Django models dynamically

2019-12-29 Thread Meet Vasani
Is there any way to create model for the database using form input from the end user ? Scenario: There is authority for the particular company. Authority wants to create HTML form schema according to company which he's affiliated with. There are many Authorities with diffrent companies they're

Re: FieldError at / Django models how to reslove this issue....

2019-12-19 Thread Jack Lin
FYI, you can check this documentation for double underscore in Django. -- Jack Lin 在 2019年12月20日 於 上午1:28:29, Simon Charette (charett...@gmail.com) 寫下: You are missing an underscore here. It should be published_date

Re: FieldError at / Django models how to reslove this issue....

2019-12-19 Thread Simon Charette
You are missing an underscore here. It should be published_date__lte and not published_date_lte. Cheers, Simon Le jeudi 19 décembre 2019 11:40:05 UTC-5, MEGA NATHAN a écrit : > > Hi all. > > Cannot resolve keyword 'published_date_lte' into field. Choices are: author, > author_id, comments, crea

FieldError at / Django models how to reslove this issue....

2019-12-19 Thread MEGA NATHAN
Hi all. Cannot resolve keyword 'published_date_lte' into field. Choices are: author, author_id, comments, create_date, id, published_date, text, title this are models: from django.db import models from django.utils import timezone from django.urls import reverse # Create your models here.

Re: Django models and json integration

2019-08-10 Thread Suraj Thapa FC
Can you pls elaborate or have any working code On Sat, 10 Aug, 2019, 9:40 PM Andrew C., wrote: > Two options: > > 1) Save the JSON files and link it with a FileField > > 2) Use PostgreSQL’s Django-specific JSONField. > > On Sat, Aug 10, 2019 at 9:46 AM Suraj Thapa FC > wrote: > >> How can I li

Re: Django models and json integration

2019-08-10 Thread Andrew C.
Two options: 1) Save the JSON files and link it with a FileField 2) Use PostgreSQL’s Django-specific JSONField. On Sat, Aug 10, 2019 at 9:46 AM Suraj Thapa FC wrote: > How can I linked a JSON file with my db... Json files contains the key > value pair of the user data.. > If the id in the db a

Django models and json integration

2019-08-10 Thread Suraj Thapa FC
How can I linked a JSON file with my db... Json files contains the key value pair of the user data.. If the id in the db and the id in the json files matches i can fetch and read it.. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscrib

Re: django models

2019-05-07 Thread sachinbg sachin
On Tue, May 7, 2019, 12:35 PM Soumen Khatua Hi Folks, > > I didn't understand this code please help me to understand this code. > > class AddressQueryset(models.QuerySet): > def annotate_default(self, user): > # Set default shipping/billing address pk to None > # if default sh

django models

2019-05-06 Thread Soumen Khatua
Hi Folks, I didn't understand this code please help me to understand this code. class AddressQueryset(models.QuerySet): def annotate_default(self, user): # Set default shipping/billing address pk to None # if default shipping/billing address doesn't exist default_ship

Re: django models

2019-05-06 Thread Soumen Khatua
Yes,You are right as_data is custom made function inside the same class,here is the code: def as_data(self): """Return the address as a dict suitable for passing as kwargs.Result does not contain the primary key or an associated user.""" data = model_to_dict(self,exclude=['id','u

Re: django models

2019-05-06 Thread Skyisblue
Soumen, The function looks to compare two Address objects. The as_data() call is custom made. I saw it documented in your other post. It removes the Primary Key and User from the Address object. I presume this is so they can compare the hash of one address to the hash of another. Regards, Joe On

django models

2019-05-06 Thread Soumen Khatua
Hi Folks, How this underline code works? models.py class Address(models.Model): first_name = models.CharField(max_length=256, blank=True) last_name = models.CharField(max_length=256, blank=True) company_name = models.CharField(max_length=256, blank=True) street_address_1 = model

Re: passing django models data to python script

2019-02-20 Thread Mike Dewhirst
like to make it dynamic so that i can get a user input (from a web browser) and with that, run the python script internally, and pass back the data to the django models, which will update the values in the API. so far, I know how to: build a REST API with django, get user input using reactjs

passing django models data to python script

2019-02-20 Thread Ousmane Baricisse
input (from a web browser) and with that, run the python script internally, and pass back the data to the django models, which will update the values in the API. so far, I know how to: build a REST API with django, get user input using reactjs, make post and get request to get data from the API

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Thanks Simon. It's for an offline tool so high performance isn't the top priority. On Monday, 10 December 2018 11:56:53 UTC-5, Simon Charette wrote: > > Given choices are defined at the module level I guess you could > iterate over objects defined in each `sys.modules` (or the ones > likely to de

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Simon Charette
Given choices are defined at the module level I guess you could iterate over objects defined in each `sys.modules` (or the ones likely to define choices) and use the `is` operator to compare all of them to the field choices. This will perform badly and shouldn't be used for anything else than one

Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Let's say I take the following code from the Django documentatation: class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR = 'JR' SENIOR = 'SR' YEAR_IN_SCHOOL_CHOICES = ( (FRESHMAN, 'Freshman'), (SOPHOMORE, 'Sophom

Re: Create data from django models from .csv file using pandas library

2018-10-15 Thread Gaurav Toshniwal
r 15, 2018 at 3:12:45 PM UTC+4, Mohammad Aqib wrote: > > I have multiple .csv files to create data from django models into a > database using python pandas library. Can anyone suggest me how to do > perform this task. > > import pandas as pd > > df = pd.read_csv

Re: Create data from django models from .csv file using pandas library

2018-10-15 Thread Mohammad Aqib
by > Mailtrack > <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality6&;> > 10/15/18, > 5:03:59 PM > > On Mon, Oct 15, 2018 at 4:42 PM Mohammad Aqib > wrote: > >> I have multiple .csv files to create data from django

Re: Create data from django models from .csv file using pandas library

2018-10-15 Thread ansh srivastav
lity6&;> 10/15/18, 5:03:59 PM On Mon, Oct 15, 2018 at 4:42 PM Mohammad Aqib wrote: > I have multiple .csv files to create data from django models into a > database using python pandas library. Can anyone suggest me how to do > perform this task. > > import pandas as p

Create data from django models from .csv file using pandas library

2018-10-15 Thread Mohammad Aqib
I have multiple .csv files to create data from django models into a database using python pandas library. Can anyone suggest me how to do perform this task. import pandas as pd df = pd.read_csv(RESOURCE_ROOT + '/data_files/102018_core_business.csv') business_instanc

Re: django models

2018-08-14 Thread Andréas Kühne
Hi, The error is pretty self explanatory. There is a missing migration file: (u'training_kits', u'0003_auto_20160914_0722') So check your training_kits app for a migration that is called 0003_auto_20160914_0722.py. This migration is a dependency for the migration: 0004_tasktype_training_kit.py

Re: django models

2018-08-13 Thread Ramandeep Kaur
hi guys, i need your help when i run makemigrations command, i got error: django.db.migrations.exceptions.NodeNotFoundError: Migration task_types.0004_tasktype_training_kit dependencies reference nonexistent parent node (u'training_kits', u'0003_auto_20160914_0722') On Fri, Aug 10, 2018 at 8:21 P

Re: django models

2018-08-10 Thread Kasper Laudrup
Hi Ramandeep, The problem is pretty much the same as before: Mismatched parentheses, but I'll leave to you to figure out where. It's pretty easy to spot. Did you find an editor that helps you syntax check python code? It'll make your life a lot easier. Kind regards, Kasper Laudrup On August

Re: django models

2018-08-10 Thread Ramandeep Kaur
thanks i got my mistake but now again i am getting an error. my urls.py: from django.conf.urls import patterns, include, url from django.contrib import admin from django.views.generic import TemplateView from rest_framework_nested import routers from rest_auth.views import LogoutView from locat

Re: django models

2018-08-10 Thread Kasper Laudrup
Hi Ramandeep, On 08/10/2018 07:36 AM, Ramandeep Kaur wrote: > strange thing is that it indicates the error in line 395 which is in > the end where i dont write any code. It looks like your error is not closing the call to url() here: url('^api/v1/calls/beneficiary/(?P\w+)/$', # BeneficiaryCall

Re: django models

2018-08-09 Thread Mike Dewhirst
sers@googlegroups.com <mailto:django-users@googlegroups.com>>         [mailto:django-users@googlegroups.com <mailto:django-users@googlegroups.com>         <mailto:django-users@googlegroups.com <mailto:django-users@g

Re: django models

2018-08-09 Thread Mike Dewhirst
o:django-users@googlegroups.com>         <mailto:django-users@googlegroups.com <mailto:django-users@googlegroups.com>>         [mailto:django-users@googlegroups.com <mailto:django-users@googlegroups.com>         <mailto

Re: django models

2018-08-09 Thread Kasper Laudrup
Hi Ramandeep, On 08/09/2018 09:57 AM, Ramandeep Kaur wrote: hi kasper,this is my settings.py What you have added to your settings.py doesn't make any sense. It is not valid Python code as your Python interpreter correctly tells you. I have no idea what you tried to achieve by writing that.

Re: django models

2018-08-09 Thread Ramandeep Kaur
import os import sys from django.core.exceptions import ImproperlyConfigured from .base import *pip install django-generate-secret-key def get_env_variable(var_name): try: return os.environ[var_name] except KeyError: error_msg = "Set the %s environment variable" % var_name raise ImproperlyConfig

Re: django models

2018-08-09 Thread Kasper Laudrup
Hi Ramandeep, On 08/09/2018 09:25 AM, Ramandeep Kaur wrote: when i run my manage.py server its giving me invalid syntax error.   File "C:\Users\Dell\vms2\vms2\settings\base.py", line 18     from .base import *pip install django-generate-secret-key                          ^ SyntaxError: invalid

Re: django models

2018-08-09 Thread Ramandeep Kaur
t; i set the secret key but its again giving me the same errror. >>> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY >>> setting must not be empty. >>> >> >> Try running the migrations command with the settings option so >>

Re: django models

2018-08-08 Thread Mike Dewhirst
oject.com/en/dev/ref/settings/#secret-key> *From:*django-users@googlegroups.com <mailto:django-users@googlegroups.com> [mailto:django-users@googlegroups.com <mailto:django-users@googlegroups.com>] *On Behalf Of *Ramandeep Kaur *Sent:*

Re: django models

2018-08-08 Thread Ramandeep Kaur
m [mailto:django-users@ > googlegroups.com] *On Behalf Of *Ramandeep Kaur > *Sent:* Wednesday, August 8, 2018 8:50 AM > *To:* django-users@googlegroups.com > *Subject:* Re: django models > > > > I am new at Django so I don't know how to create secret key. please > expla

RE: django models

2018-08-08 Thread Matthew Pava
@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Ramandeep Kaur Sent: Wednesday, August 8, 2018 8:50 AM To: django-users@googlegroups.com Subject: Re: django models I am new at Django so I don't know how to create secret key. please explain me. On Wed, Aug 8, 2018, 1:20 PM Gerald

Re: django models

2018-08-08 Thread Ramandeep Kaur
I am new at Django so I don't know how to create secret key. please explain me. On Wed, Aug 8, 2018, 1:20 PM Gerald Brown wrote: > The last line of the error message tells you what to do. Create a Secret > Key in your settings.py file because it says it is now empty. > > On Wednesday, 08 August

Re: django models

2018-08-08 Thread Balasriharsha Cheeday
You must have removed the secret key in settings.py file, try re-adding that secret key, then it should work just fine On Tuesday, August 7, 2018 at 10:17:00 AM UTC-7, Ramandeep Kaur wrote: > > My question is that how to delete models in django? > -- You received this message because you are su

Re: django models

2018-08-08 Thread Gerald Brown
The last line of the error message tells you what to do.  Create a Secret Key in your settings.py file because it says it is now empty. On Wednesday, 08 August, 2018 02:43 PM, Ramandeep Kaur wrote: when i run this ./manage.py makemigrations it gives some error. Don't know what to do. Traceba

Re: django models

2018-08-07 Thread Ramandeep Kaur
when i run this ./manage.py makemigrations it gives some error. Don't know what to do. Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_co

Re: django models

2018-08-07 Thread Gerald Brown
Just delete the code in models.py and run ./manage.py makemigrations and ./manage.py migrate. On Wednesday, 08 August, 2018 01:14 AM, Ramandeep Kaur wrote: My question is that how to delete models in django? -- You received this message because you are subscribed to the Google Groups "Django

Re: django models

2018-08-07 Thread Christophe Pettus
> On Aug 7, 2018, at 10:14, Ramandeep Kaur wrote: > > My question is that how to delete models in django? Do you need to delete a model *class*, or a model *instance*? -- -- Christophe Pettus x...@thebuild.com -- You received this message because you are subscribed to the Google Groups

django models

2018-08-07 Thread Ramandeep Kaur
My question is that how to delete models in 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 gr

Re: how set image (dimension) upload height and weight in django models without from

2018-03-20 Thread Andréas Kühne
Hi, I use a plugin called easy thumbnails for things like this. It doesn't set what the user can upload, however it scales the uploads to the dimensions you need. See here : https://pypi.python.org/pypi/easy-thumbnails Regards, Andréas 2018-03-20 13:50 GMT+01:00 arvind yadav : > class Member(

how set image (dimension) upload height and weight in django models without from

2018-03-20 Thread arvind yadav
class Member(models.Model): id = models.AutoField(db_column='ID', primary_key=True) name = models.CharField(db_column='NAME', max_length=255) member = models.CharField(db_column='MEMBER', max_length=255) sequence_num = models.IntegerField(db_column='SEQUENCE_NUM') img_url =

Re: How can i get more clear understanding on django models?

2018-01-05 Thread Etienne Robillard
you can put docstrings to document what the classes are doing.. :-) cheers, Etienne Le 2018-01-05 à 05:52, utpalbrahma1...@gmail.com a écrit : from django.db import models class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.Date

How can i get more clear understanding on django models?

2018-01-05 Thread utpalbrahma1995
from django.db import models class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharFie

Re: having trouble with django models

2017-12-17 Thread Mike Dewhirst
On 17/12/2017 9:26 AM, Daniel Roseman wrote: This is expected behaviour. You've set them to be populated automatically on create and update. So there's no need to be modifiable via the admin. Of course! However, if you want to see the fields you have to mention them among other fields you wi

having trouble with django models

2017-12-16 Thread Daniel Roseman
This is expected behaviour. You've set them to be populated automatically on create and update. So there's no need to be modifiable via the admin. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: having trouble with django models

2017-12-16 Thread Mike Dewhirst
On 16/12/2017 10:06 PM, Mukul Agrawal wrote: Hello, I am newbie to django. I was trying my hand on models. When i used the below code in models.py, "timestamp" and "updated" are not able visible on admin site. Is something wrong with the code? It looks OK to me. Have you included them in your

having trouble with django models

2017-12-16 Thread Mukul Agrawal
Hello, I am newbie to django. I was trying my hand on models. When i used the below code in models.py, "timestamp" and "updated" are not able visible on admin site. Is something wrong with the code? ''' from django.db import models # Create your models here. class RestaurantLocation(models.Mod

Re: Help with Django Models

2017-12-13 Thread Mike Dewhirst
On 14/12/2017 11:14 AM, Udit Vashisht wrote: Thanks for the reply. I am new to python and django. Will have to google a lot to understand your solution :-) Look at models.ForeignKey ... https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey When you add a foreign key field to a t

Re: Help with Django Models

2017-12-13 Thread Mike Dewhirst
On 14/12/2017 3:15 AM, Udit Vashisht wrote: I have an outside python function which reads a csv from web and fetch certain data in forms of tuple. So that i can use that tuple in my python models for choices in one of the fields. Till now i am running the function independently and copying the

Help with Django Models

2017-12-13 Thread Udit Vashisht
I have an outside python function which reads a csv from web and fetch certain data in forms of tuple. So that i can use that tuple in my python models for choices in one of the fields. Till now i am running the function independently and copying the returned tuple to my models.py for choices.

Django forms and django models

2017-11-30 Thread Andrea Cristiana Adamczyk Abascal
I have an attribute of a model called "options" that is an array of prayers that are entered through textinputs. How can I declare this attribute in the model and what widget may I use in the model form? thank you! -- You received this message because you are subscribed to the Google Groups "

Django Models Relationship

2017-09-12 Thread james lin
Hi, I have the following models: class UserPost(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) post = models.ForeignKey(Post, on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add=True) class User(AbstractUser): MALE =

Re: [Ask for help]How to convert django models schema to json?

2016-11-01 Thread GMail
Hi! There's also an alternative to Django REST Framework - Tastypie (https://django-tastypie.readthedocs.io/en/latest/ <https://django-tastypie.readthedocs.io/en/latest/>). You could use [Namespaced]ModelResource with Django Models. And if you're not interested in API and

Re: [Ask for help]How to convert django models schema to json?

2016-11-01 Thread Asif Saifuddin
But seems like you are using sqlalchemy models. for sqlalchemy models you could try sqlalchemy-marshmellow On Wednesday, November 2, 2016 at 2:27:47 AM UTC+6, 周华 wrote: > > >- This is an example models >- class UserModel(db.Model): >__tablename__ = "user" >id = db.Column(d

Re: [Ask for help]How to convert django models schema to json?

2016-11-01 Thread Asif Saifuddin
Hi, you can try django-rest-frameworks model serializer, modelviewsets and django-json-api package for this job. thanks On Wednesday, November 2, 2016 at 2:27:47 AM UTC+6, 周华 wrote: > > >- This is an example models >- class UserModel(db.Model): >__tablename__ = "user" >i

[Ask for help]How to convert django models schema to json?

2016-11-01 Thread 周华
- This is an example models - class UserModel(db.Model): __tablename__ = "user" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.String(255), unique=True) name = db.Column(db.String(255)) - This is a Json example which I want

Re: Accessing session in Django models?

2016-08-03 Thread Constantine Covtushenko
Hi Neto, As said in Documentation of 'limit_choices_to' value for this key should be: `Either a dictionary, a Q object, or a callable returning a dictionary or Q object can be used.` For your c

Accessing session in Django models?

2016-08-03 Thread Neto
I have a field with *limit_choices_to*, and want it to be only filtered items related the account ('ID') user. How can I do this? Example (Does not work): class Car(models.Model): user = models.ForeignKey(User) color = models.CharField(max_length=200) typeo = models.ForeignKey(Typeo,

Re: Search multiple fields in Django Models

2016-08-01 Thread Constantine Covtushenko
Hi Jurgens, Django is the right choice. With Django all are possible. All that you described are possible. If you need more precise answer give us more precise question. Regards, On Mon, Aug 1, 2016 at 4:21 PM, Jurgens de Bruin wrote: > Hi, > > I am new to Django, I have been using TurboGears

Search multiple fields in Django Models

2016-08-01 Thread Jurgens de Bruin
Hi, I am new to Django, I have been using TurboGears for the last few years. I would like to help with regards to a multi search function. In essence I would like 1 search field/form that will search multiple fields of different datatype example user should be able to search the model/db for e

Re: Django Models

2016-05-27 Thread Ken Edem
Wow, Derek what a great link. Thanks very much. Ken On Friday, May 27, 2016 at 4:47:56 PM UTC+2, Derek wrote: > > There a number of designs for similar situations online; a quick Google > showed me: > > * http://www.databasedev.co.uk/student_courses_data_model.html > * http://databaseanswers.org

  1   2   3   4   5   >