Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:48:22+00:00 2026-05-30T09:48:22+00:00

i have a generate(variable) function in another file, i want to call it in

  • 0

i have a generate(variable) function in another file, i want to call it in my models.py file.
here is my code.

class Season(models.Model):
    Year = models.CharField(max_length=6, default=getyear())
    start_date = models.DateField()
    end_date = models.DateField()
    league = models.ManyToManyField(League)
    fixgen = models.BooleanField(default=False)
    in_progress = models.BooleanField(default=True)

    def __unicode__(self):
        return self.Year

    def createfixtures(self):
        generate(self)

but when i run the file, it gives me the following error.

Validating models...
Unhandled exception in thread started by <function inner_run at 0xa05eae4>
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/django/core/management/commands/runserver.py", line 48, in inner_run
    self.validate(display_num_errors=True)
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/lib/pymodules/python2.7/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/usr/lib/pymodules/python2.7/django/db/models/loading.py", line 146, in get_app_errors
    self._populate()
  File "/usr/lib/pymodules/python2.7/django/db/models/loading.py", line 64, in _populate
    self.load_app(app_name)
  File "/usr/lib/pymodules/python2.7/django/db/models/loading.py", line 78, in load_app
   models = import_module('.models', app_name)
  File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module
__import__(name)
  File "/home/yousuf/PycharmProjects/CricketManager/../CricketManager/Cricket/models.py", line 4, in <module>
    from Cricket.fixtures import generate
  File "/home/yousuf/PycharmProjects/CricketManager/Cricket/fixtures.py", line 3, in <module>
    from Cricket.models import League, Season, Team, Fixture
  File "/home/yousuf/PycharmProjects/CricketManager/Cricket/models.py", line 4, in <module>
    from Cricket.fixtures import generate
ImportError: cannot import name generate

can i import a function that works fine if i call it from django shell. now i want to have it as part of django admin menu.

if somebody can look at it, and see what the problem is, or what is the work around for it.

//yousuf

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:48:24+00:00Added an answer on May 30, 2026 at 9:48 am

    It looks like you have a circular import between Cricket.models and Cricket.fixtures. You will need to move common definitions out into a third module to break the cycle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call a method, pass it the length and have it generate
For testing purposes I have to generate a file of a certain size (to
i'm want to have a repeater generate a bunch of checkboxes, e.g.: <tr><td><input type=checkbox
I have this program that I want other processes to be able to call
Is there any way how to call JQuery function from PageLoad C# file? Basically
Hi I have a function that will generate a random string which works fine.
So I have a simple cpp file. Only one with one main function and
I have a function that creates a 2D vector void generate(int n) { vector<
I know that it is possible to call a function with a variable number
I have global static variables in a C library, which generate exceptions in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.